<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[BBGO - Medium]]></title>
        <description><![CDATA[BBGO is an open source crypto trading platform designed for trading bots - Medium]]></description>
        <link>https://medium.com/bbgo?source=rss----244d4e0e224b---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>BBGO - Medium</title>
            <link>https://medium.com/bbgo?source=rss----244d4e0e224b---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 15 Nov 2026 06:42:45 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/bbgo" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com" rel="hub"/>
        <item>
            <title><![CDATA[BBGO — What’s New in v1.40.x]]></title>
            <link>https://medium.com/bbgo/bbgo-whats-new-in-v1-40-x-bb80d447d5b1?source=rss----244d4e0e224b---4</link>
            <guid isPermaLink="false">https://medium.com/p/bb80d447d5b1</guid>
            <category><![CDATA[trading-bot]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[c9s]]></dc:creator>
            <pubDate>Wed, 14 Sep 2022 14:00:46 GMT</pubDate>
            <atom:updated>2022-09-14T14:01:57.985Z</atom:updated>
            <content:encoded><![CDATA[<h3>BBGO — What’s New in v1.40.x</h3><h3>What’s BBGO?</h3><p><a href="https://github.com/c9s/bbgo">BBGO</a> is an open source crypto trading framework designed for trading bots, written in Go programming language.</p><h3>What You Can Do With BBGO?</h3><p>For Trading Bot Users 💁‍♀️ 💁‍♂️ — You can use <a href="https://github.com/c9s/bbgo">BBGO</a> to run the built-in strategies.</p><p>For Strategy Developers 🥷 — You can use <a href="https://github.com/c9s/bbgo">BBGO</a>’s trading unit and back-test unit to implement your own strategies.</p><p>For Trading Unit Developers 🧑‍💻 — You can use BBGO’s underlying common exchange API, currently it supports 4+ major exchanges, so you don’t have to repeat the implementation. (BBGO supports Binance, FTX, OKEx and Kucoin)</p><p>#1 Added New Telegram Commands</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/802/1*RRogQ99I6fUOL8l54pH0iA.png" /></figure><p>/resetposition</p><p>For people who wants to reset the position, you can use the telegram bot command /resetposition to reset the position directly. Without the need to open the redis-cli and flushall the settings</p><p>/modifyposition</p><p>For people who manually placed orders to buy/sell some inventory, you can modify the strategy position by yourself. Three fields are modifiable:</p><ol><li>Cost — the average cost of your position. This should be a positive number, that is, your average executed price.</li><li>Base — this is the base quantity of your position. for example, the quantity of BTC. Positive number means you hold a Long position, negative means you hold a Short position.</li><li>Quote — this is quote quantity (or amount) you spent to buy your BTC. for example, -3200 USDT. For long position, the quote is usually a negative number, it means you spend X USDT to buy Y BTC.</li></ol><p>#2 New Order Executor API</p><p>You can now call the OpenPosition method to open a long/short position in a spot account or a leveraged account. For example, to open a 3x leveraged long position, you can simply call:</p><pre>orderExecutor.OpenPosition(bbgo.OpenPositionOptions{<br>   Leverage: 3.0,<br>   Long: true,<br>})</pre><p>The account value calculator will fetch the asset price and calculate your account value in USD, and automatically convert the value into the quantity of your order.</p><p>#3 New Built-in Strategy — <a href="https://github.com/c9s/bbgo/blob/main/config/elliottwave.yaml">elliotwave</a></p><p>This strategy is a rewrite of ewoDgtrd strategy. If you’re interested in it, you can check out the default config to see how to use it.</p><p>#4 New Built-in Strategy — <a href="https://github.com/c9s/bbgo/blob/main/config/pivotshort.yaml">pivotshort</a></p><p>This strategy focuses on opening short, which can be applied to spot, margin account or futures account. You can also setup multiple exit methods to close your position. For example: trailingStop, roiStopLoss, roiTakeProfit, accumulatedVolumeTakeProfit .. and so on..</p><p>#5 New Built-in Strategy — <a href="https://github.com/c9s/bbgo/blob/main/config/supertrend.yaml">supertrend</a></p><p>This built-in strategy is based on the supertrend indicator. It works for both direction, Long and Short.</p><p>#6 Built-in Exit Method API</p><p>For strategies support built-in exit methods, you can describe your exit conditions in a descriptive YAML, for example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_OrvmCx3DvBojwEuqXydA.png" /></figure><p>#7 New bollmaker protection mech</p><p>The bollmaker strategy now supports different dynamic spread methods, sigmoid and amplify.</p><p>the newly introduced trendEMA indicator also improves the net profit and unrealized profit during the bear market.</p><p>bollmaker PnL without trendEMA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/0*CFgKmJ4LR91kULat" /></figure><p>bollmaker PnL with trendEMA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/924/0*OSJqwy5Pgxa-bFoa" /></figure><p>And this is the date range we used for testing trendEMA:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*Y5t7TPyp92xSYSc6" /></figure><p>If you like BBGO and would like to support our project, you can use the following referral link to get a 5% commission kickback:</p><p><a href="https://accounts.binance.com/en/register?ref=VGDGLT80">Bitcoin Exchange | Cryptocurrency Exchange | Binance</a></p><p>If you need any help with BBGO, you can create an issue in the <a href="https://github.com/c9s/bbgo">GitHub project</a>, or join our telegram group:</p><p><a href="https://t.me/bbgo_intl">BBGO International</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bb80d447d5b1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bbgo/bbgo-whats-new-in-v1-40-x-bb80d447d5b1">BBGO — What’s New in v1.40.x</a> was originally published in <a href="https://medium.com/bbgo">BBGO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BBGO — BollMaker Trading Bot]]></title>
            <link>https://medium.com/bbgo/bbgo-bollmaker-trading-strategy-3a4e80b482e3?source=rss----244d4e0e224b---4</link>
            <guid isPermaLink="false">https://medium.com/p/3a4e80b482e3</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[trading-bot]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[c9s]]></dc:creator>
            <pubDate>Wed, 04 May 2022 18:33:13 GMT</pubDate>
            <atom:updated>2022-05-13T11:14:27.964Z</atom:updated>
            <content:encoded><![CDATA[<h3>BBGO — BollMaker Trading Bot</h3><h4>Are you still using the traditional grid trading bot for cryptocurrency?? Try BollMaker Trading Bot</h4><p>Since the rapid development of the cryptocurrency market, grid trading has become widely known as automated trading strategy.</p><p>However, there are many problems with the grid trading strategy. For example, you may sell off in a fast-rising market, or get stuck in a fast-falling market, and you need to adjust the price band very frequently.</p><p>Grid Orders placed at higher prices and lower prices are not efficiently used, you just hang these orders there and lock your balance and it does not generate any profit if the market price range is small.</p><p>At the end, you will find out, Grid Trading is really an inefficient trading strategy!</p><p>So, I decided to start developing a new trading bot, a brand new trading strategy that would overcome the shortcomings of the grid strategy.</p><p>And strategy bollmaker came into being.</p><h3>What’s BollMaker?</h3><p>BollMaker is an acronym for a Bollinger band based market-making strategy.</p><p>This strategy uses dual Bollinger bands for trading, but it does not use the bands traditionally.</p><p>It uses a band with a short time period to detect fast-moving price.</p><p>In addition, a band with a long period of time is used to dynamically adjust the limit of the maximum holding position.</p><p>And BollMaker is one of the trading strategies in BBGO — A crypto trading bot framework!</p><h3>What’s BBGO?</h3><p><a href="https://github.com/c9s/bbgo">BBGO</a> is an open source crypto trading framework designed for trading bots, written in Go programming language.</p><h3>What You Can Do With BBGO?</h3><p>For Trading Bot Users 💁‍♀️ 💁‍♂️ — You can use <a href="https://github.com/c9s/bbgo">BBGO</a> to run the built-in strategies.</p><p>For Strategy Developers 🥷 — You can use <a href="https://github.com/c9s/bbgo">BBGO</a>’s trading unit and back-test unit to implement your own strategies.</p><p>For Trading Unit Developers 🧑‍💻 — You can use BBGO’s underlying common exchange API, currently it supports 4+ major exchanges, so you don’t have to repeat the implementation. (BBGO supports Binance, FTX, OKEx and Kucoin)</p><h3>And, What’s a market maker strategy?</h3><p>A market maker is a firm, individual or trading strategy that always or often quotes both a buy and a sell price for a financial instrument or commodity, hoping to make a profit by exploiting the difference between the two prices, known as the spread.</p><p>As soon as an order is received from a buyer, the Market Maker sells the shares from its own inventory and completes the order. And, this process increases the liquidity in the market. Hence, it is known as Market Making Strategy.</p><p>Generally, Market Maker profit by charging higher ask prices (selling) than bid prices (buying). The difference is called the ‘spread’.</p><p>The spread compensates the market makers for the risk inherited in such trades which can be the price movement against the market makers’ trading position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/661/0*w5TWekCpO05BO5Om.png" /></figure><p>And Market Maker Strategy is the strategy designed for market maker, to provide liquidity. (Grid strategy is also a maker strategy that provides liquidity)</p><h3>How does BollMaker perform?</h3><p>Let’s see the back-testing result first:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/946/1*ZJ2XZtE4u4Of8_yotjSD3g.jpeg" /></figure><p>We used the back-testing data from 2021–08–01 to 2021–09–01. As you can see, the initial capital $20,000, and it realized profit by $7,326.69. The estimated APY is ~= 8293%.</p><p>But wait! the APY is just an estimation, APY may vary depending on market fluctuations.</p><p>Let me show you the real order history of the BollMaker strategy before we explain these details, here are some screenshots:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*GZFdnl60JXIfe3sj" /><figcaption>BBGO Trading Bot — BollMaker @ DOTUSDT</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*qOU-TSncUqrkIKOl" /><figcaption>BBGO Trading Bot — BollMaker @ DOTUSDT</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/591/0*KBhIjvsiiAe_d5M1" /><figcaption>BBGO Trading Bot — BollMaker @ BNBUSDT</figcaption></figure><h3>How Does It Work?</h3><p>The BollMaker Strategy uses the long-term period Bollinger Band to control the holding position.</p><p>The basic concept is, we assume the price will bounce between the long-term Bollinger band boundary. So, when the price goes up to the upper band, we reduce the position limit, and try to place sell orders as maker. If someone places a taker order to buy from your sell order, then you will sell your inventory.</p><p>On the other hand, when the price goes down to the lower band, we increase the position limit, and try to place buy orders as maker. If someone places a taker order to sell his inventory to you, then you will buy your inventory.</p><p>For example, when the price is close to the top of the Bollinger Band, we can set “the maximum amount of ETH to buy” is 0.1, and when the price is close to the bottom of the Bollinger Band, we can set “the maximum amount to buy” ETH to 10.</p><p>Therefore, through such price movements and dynamic control positions, we can use the spread in the market to buy low and sell high to make a profit.</p><p>The strategy locates the price in the band, and uses the exponential scale to calculate the inventory position limit — The lower the price, the higher the holding position.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KPeTcTn5_InEsjpb.png" /></figure><p>In this way, the cost of holding positions can be reduced by expanding the position.</p><p>By using the concept of average down the cost of position in a downtrend, and when the rebound pulls back to the upper band of the Bollinger Band, the position can be reduced. So as long as you have enough capital, you can make money in the market cycle.</p><p>Hence, it’s best to prepare the capital around ~$20,000 when you set the order amount at $20. (Above the minimal order size requirement of the crypto exchange). You will have $20,000/$20 = 1,000 times to average down your inventory cost.</p><h3>Appropriate Markets and Scenarios</h3><p>Basically, the main purpose of running the BollMaker strategy is to stock up. Stocking and escaping are two extremes. It is difficult to use the same set of settings to have both. Therefore, you need to choose an asset that you are willing to invest in the long-term, not to choose speculative coins to trade.</p><p>When you feel that the market is ready to start stockpiling, it is very suitable to run the BollMaker strategy.</p><p>It is recommended to run the currency with relatively high market cap, the trading volume is high, and the volatility is also high. Sometimes when large cap coins fall by 8%, some small cap coins can fall by 20% in one day.</p><h3>How to setup?</h3><p>🧑‍💻 Before you get started, if you like my automatic trading strategy, please give me some support and encouragement, and you can use the author’s referral code to register for Binance 🙏</p><p>Binance <a href="https://accounts.binance.com/en/register?ref=38192708">https://accounts.binance.com/en/register?ref=38192708</a></p><p>First, you need to prepare an API Key and an API Secret. If you don’t know API Keys, you can <a href="https://www.binance.com/en/support/faq/360002502072">check Binance’s FAQ page first.</a></p><p>Then, you need a Linux/MacOS environment, and a redis server for data persistency. (It will be used to store your profit stats and position information):</p><p>For Linux:</p><pre>sudo apt install redis</pre><p>If the redis package is not found, use redis-server instead:</p><pre>sudo apt install redis-server</pre><p>For Mac OS, you can use <a href="https://redis.io/docs/getting-started/installation/install-redis-on-mac-os/">brew</a>:</p><pre>brew install redis</pre><p>Now, you can use the automation script to set up your BBGO:</p><pre>bash &lt;(curl -s <a href="https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-bollmaker.sh">https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-bollmaker.sh</a>)</pre><p>This script downloads the latest BBGO release binary and set up your API key for BBGO.</p><p>And it should show you the following screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m8RlbkrED0Wc9Bbsq0iB9g.png" /><figcaption>BBGO — BollMaker Installer</figcaption></figure><p>What’s most important though, is that it gives you the bbgo binary also (the bbgo file), a bbgo.yaml config file and a .env.local file for storing your API secret.</p><p>If you don’t want to use the script, you can also download the bbgo.yaml file by yourself:</p><pre>wget <a href="https://gist.github.com/c9s/9a69dc6e17e418411c860ac8350bb939/raw/488d8972bb3e3077667758982fa82264db7eed82/bbgo.yaml">https://gist.github.com/c9s/9a69dc6e17e418411c860ac8350bb939/raw/488d8972bb3e3077667758982fa82264db7eed82/bbgo.yaml</a></pre><p>By default, the bollmaker configuration file looks like this:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4d3ceb80b7845d7a8d09ea6009f93ce8/href">https://medium.com/media/4d3ceb80b7845d7a8d09ea6009f93ce8/href</a></iframe><p>Now, let me explain these parameters:</p><ul><li>symbol is the market symbol you want to trade. you can use BTCUSDT , BNBUSDT, or ETHUSDT something like that.</li><li>interval is the period that you want to replace your maker orders. 1m means it will cancel all open orders and re-place the maker order per minute. valid values are 1m, 5m, 15m , 30m</li><li>amount is the quote amount of your order. 30 for ETHUSDT market means you want to place a 30 USDT equivalent order to buy/sell ETH. You should have amount set at least above 20</li><li>quantity is the base amount of your order. 0.1 for ETHUSDT market means you want to buy/sell 0.1 ETH for each order. quantity can not be used with amount, you can only use either amount or quantity.</li><li>askSpread and bidSpread are the spread you want to place the order. BollMaker uses the mid price to place your maker order. For example, if mid price is 3000, with bidSpread=0.1% and askSpread=0.1%, we will place the buy order at price 2997 and sell order at price 3003. You can use candle chart to find out the amplification of each interval and use them.<br>In the best case, you should be able to have buy/sell orders trade per interval. Please note that the rate of transaction fees must be taken into account. On Binance, the maker fee rate is about 0.075%, so make sure your bidSpread + askSpread &gt; (0.075% * 2).</li><li>minProfitSpread is the spread from the average cost of your inventory. when Price ≥ AVERAGE_COST * (1.0 + minProfitSpread), then the sell order be will placed. You can set this number to a higher value like 1% or even 3% to prevent you sell the inventory too early.</li></ul><p>And then, the following section is the most important section:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/958/1*m31qpAbW6ksKLzbDjVzJlg.png" /></figure><p>domain -1 means the lower band of the long-term Bollinger band.</p><p>doamin 1 means the upper band of the long-term Bollinger band.</p><p>For example, if you would like to trade in ETHUSDT,</p><p>10.0 means, when the price goes down to the boundary of the lower band, you will have the maximum position limit at 10 ETH.</p><p>And 1.0 means, when the prices goes up to the boundary of the upper band, you will have the maximum position limit at 1.0 ETH. If your inventory is higher than the maximum position limit, it will not stop placing buy orders, until the sell orders are executed and filled.</p><ul><li>long means you don’t want to hold a short position. If short mode is enabled, it will sell the inventory that you already have in the spot wallet. You can turn on long when you think the price is low enough. And turn on short when you think the price is high enough.</li><li>buyBelowNeutralSMA is an option to limit the buy order — only place buy orders below the SMA of the neutral Bollinger band (the short-term Bollinger band)</li><li>tradeInBand — If this is set, when the price is out of the neutral Bollinger band (the short-term Bollinger band), it will stop placing buy order and sell order.</li><li>defaultBollinger — This is the Bollinger Band used for controlling the position limit. You can use TradingView or Binance’s KLines Chart to see which interval is preferred and works best for you.</li><li>neutralBollinger — This is the Bollinger Band used for detecting short-term trend.</li></ul><p>The default configuration is the best parameters as far as I know. so you should be able to run it directly.</p><p>It’s pretty straight-forward to run BBGO, simply type:</p><pre>./bbgo run</pre><p>You should then see the console logs from BBGO:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nSOJSW5H1FF7AzbJ07NiNQ.png" /></figure><p>As you can see, it calculates the max position limit per interval:</p><pre>calculated max exposure position: 2.02801869 strategy=bollmaker</pre><p>And following band is used for calculating the exposition position limit:</p><pre>bollinger band: up 2884.638519 sma 2824.866667 down 2765.094815 strategy=bollmaker</pre><p>And that’s it!</p><p>If you need any help with BBGO, you can create an issue in the <a href="https://github.com/c9s/bbgo">GitHub project</a>, or join our telegram group:</p><p><a href="https://t.me/bbgo_intl">BBGO International</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a4e80b482e3" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bbgo/bbgo-bollmaker-trading-strategy-3a4e80b482e3">BBGO — BollMaker Trading Bot</a> was originally published in <a href="https://medium.com/bbgo">BBGO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Discovering BBGO]]></title>
            <link>https://medium.com/bbgo/discovering-bbgo-6f8c01d50532?source=rss----244d4e0e224b---4</link>
            <guid isPermaLink="false">https://medium.com/p/6f8c01d50532</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[trading-bot]]></category>
            <dc:creator><![CDATA[c9s]]></dc:creator>
            <pubDate>Wed, 04 May 2022 15:57:03 GMT</pubDate>
            <atom:updated>2022-05-04T16:06:59.626Z</atom:updated>
            <content:encoded><![CDATA[<p>(This article was written by Arthur Wolf and has been authorized by the author)</p><p><a href="https://smoothieware.org/">I</a> discovered crypto a while ago, I was one of the users who lost Bitcoins in the 2013 hack of the MtGox exchange, and only a year after that I spent 300 BTC to buy a second-hand hard-drive.</p><p>Imagining where I would be if I had just hodl those coins in a cold wallet really stings.</p><p>Recently, looking back at those two bad decisions recently got me itching to get back into it, and around the beginning of the Corona Virus crisis, I started investing a bit of money into crypto again.</p><p>I also love programming, so I started looking into crypto bots.</p><p>At first, I used Kucoin’s <a href="https://kucoin.notion.site/kucoin/KuCoin-Trading-Bot-FAQ-a83bab1123094dea957851811a1a2fb7">Spot Grid</a> trading bot.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cFHewJJz8XqU9HHF" /></figure><p>It works pretty well, and doing everything inside a web interface is nice, but it didn’t allow for much customization, and there were some features I wanted, and I had no way to add them.</p><p>So, I started to look into <a href="https://github.com/DeviaVir/zenbot">Zenbot</a>. It’s JavaScript (which I like), but it didn’t have Grid trading (the strategy I like most).</p><p>So I spent two months implementing grid trading into it. As I went, the quality of the code was so bad, and the performance so slow, that I spent much more time fixing/improving things than actually doing anything helpful.</p><p>I was about to give up, when just to make sure I didn’t miss anything, I searched once more for trading bot projects on GitHub, and found this new project named <a href="https://github.com/c9s/bbgo">BBGO</a>.</p><p>It was perfect. It natively did Grid trading (no need to add it myself), and it was BLAZZING fast (and the code was the cleanest of any such project I had seen).</p><p>The reason it’s important that the project be fast, in my use case, is that I use genetic (and other) optimization algorithms to find the best strategies (using back testing) to trade hundreds of coins at once. This results in running thousands of bots in parallel on a server. When I switched to BBGO, simulations that took weeks before with Zenbot, now took only hours with BBGO.</p><h3>Using BBGO</h3><p>Getting started with BBGO is pretty straightforward.</p><p>You can follow <a href="https://github.com/c9s/bbgo">the instructions</a> yourself, but here’s what I do:</p><p>1, I run the automated setup script:</p><pre>bash &lt;(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh) binance</pre><p>Running it will give an output like this:</p><pre>╰─○ bash &lt;(curl -s https://raw.githubusercontent.com/c9s/bbgo/main/scripts/setup-grid.sh) binance<br>downloading...<br>% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current<br>								Dload  Upload   Total   Spent    Left  Speed<br>0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0<br>100 17.9M  100 17.9M    0     0  14.6M      0  0:00:01  0:00:01 --:--:-- 35.1M<br>downloaded successfully<br>Enter your BINANCE API key: test<br>Enter your BINANCE API secret: test<br>generating your .env.local file...<br>dotenv is configured successfully<br>config file is generated successfully<br>================================================================<br>now you can edit your strategy config file bbgo.yaml to run bbgo<br>you look like a pro user, you can edit the config by:</pre><pre>vim bbgo.yaml</pre><pre>To run bbgo just type: </pre><pre>./bbgo run</pre><pre>To stop bbgo, just hit CTRL-C</pre><p>This one is for the Binance exchange, and the grid strategy (this matters only in that it gives you “default” config files that reflect this).</p><p>What’s most important though, is that it gives you the bbgo binary also (the bbgo file), and a bbgo.yaml config file.</p><p>By default, the bbgo.yaml file looks like this:</p><pre>---<br>exchangeStrategies:<br>- on: binance<br>  grid:<br>    symbol: BTCUSDT<br>    quantity: 0.001<br>    gridNumber: 100<br>    profitSpread: 100.0<br>    upperPrice: 50_000.0<br>    lowerPrice: 10_000.0<br>    long: true</pre><p>This configures the strategy (here we&#39;re using Grid to trade BTC versus USDT).</p><p>Another important file is the ENV file (it&#39;s hidden, it&#39;s named .env.local ), it looks like this by default:</p><pre>BINANCE_API_KEY=test<br>BINANCE_API_SECRET=test</pre><p>(Of course, here you input your Binance API keys, instead of test).</p><p>Now that all of this is setup properly, you are ready to run BBGO yourself, simply do:</p><pre>./bbgo run</pre><p>And your adventure begins!</p><p>In other articles, we&#39;ll cover back testing, the database, optimizations, but for now this should do as an introduction.</p><p>If you need any help with BBGO, you can create an issue in the <a href="https://github.com/c9s/bbgo">GitHub project</a>, or email me at <a href="mailto:wolf.arthur@gmail.com">wolf.arthur@gmail.com</a></p><p>This article was written as part of our “ArticleForNewFeature” initiative, Arthur is the first participant. If you like BBGO and want to share your knowledge about it, you can write an article on any BBGO-related topic, and in exchange I will implement a new feature of your choice, and of a size matching your article.</p><p>DM <a href="https://t.me/c123456789s">me</a> if you’re interested in.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6f8c01d50532" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bbgo/discovering-bbgo-6f8c01d50532">Discovering BBGO</a> was originally published in <a href="https://medium.com/bbgo">BBGO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[BBGO Grid Trading on OKEx]]></title>
            <link>https://medium.com/bbgo/okex-grid-trading-with-bbgo-cd2f756d63e2?source=rss----244d4e0e224b---4</link>
            <guid isPermaLink="false">https://medium.com/p/cd2f756d63e2</guid>
            <category><![CDATA[okex]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[bbgo]]></category>
            <category><![CDATA[grid-trading]]></category>
            <dc:creator><![CDATA[c9s]]></dc:creator>
            <pubDate>Tue, 28 Dec 2021 17:21:03 GMT</pubDate>
            <atom:updated>2021-12-28T17:38:26.367Z</atom:updated>
            <content:encoded><![CDATA[<p><a href="https://blog.coincodecap.com/go/okex"><strong>OKEx</strong></a> is one of the largest <a href="https://blog.coincodecap.com/crypto-exchange">crypto exchanges</a> that accounts for over $1.5 billion only from its futures trading platform.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*WI95ubDYKusE5Njb.png" /></figure><p>BBGO is an open source crypto trading bot written in Go programming language, and it has a built-in grid trading strategy.</p><p>If you haven’t heard it, you can <a href="https://github.com/c9s/bbgo">check out the GitHub project here</a>.</p><p>This article will talk about how to run BBGO grid trading bot on OKEx.</p><p>First things first, you should have an OKEx account before you get started, you can <a href="https://www.okex.com/join/2412712?src=from:ios-share">register the OKEx account here with the referral code</a> to support BBGO.</p><p>After you registered your account, click the user icon on the top right of the web page, you shall see the “API” link. Click it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/341/1*tV-Agf5WgMu5exG3y4I6HQ.png" /></figure><p>And then click the “Create V5 API Key” button to create your API Key:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/179/1*eUlp7QuyQCV-ljCpOn598w.png" /></figure><p>You should see the API Key creation form like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/764/1*jT9aSstDVczpK7OoXW66fw.png" /></figure><p>Please give the key a name and choose on the “Trade” option. Then click on the “Create” button.</p><p>The API key will then be created, you should safely note or store the API key and API secret. We will use them later.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KmDyOCtj1OekhdLG.png" /></figure><p>To run BBGO, you need two files:</p><ol><li>bbgo.yaml the core configuration file. it contains the strategy configuration, risk management and exchange session configuration.</li><li>.env.local the dotenv file, it contains your API key, API secrets and other credentials.</li></ol><p>To set up the OKEx session with BBGO, you need a dotenv file, usually named “.env” or “.env.local”, let’s create a file named .env.local, and put your API key and API secret into the file:</p><pre>OKEX_API_KEY=1089cbbb-xxxxxxxxxxxxxxxxxxxxxxxxxxxx<br>OKEX_API_SECRET=3Fxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br>OKEX_API_PASSPHRASE=zzxxxxxxxxxxxxxxxxxxxxxxxxxxxx</pre><p>Now let’s create the bbgo.yaml file:</p><pre>---<br>sessions:<br>  okex:<br>    exchange: okex<br>    envVarPrefix: okex</pre><pre>exchangeStrategies:<br>- on: okex<br>  grid:<br>    symbol: BTCUSDT<br>    quantity: 0.001<br>    gridNumber: 200<br>    profitSpread: 5000<br>    upperPrice: 50_000<br>    lowerPrice: 46_000</pre><p>The above config content is in YAML format, which contains 2 sections, the first one is the session, you can see we defined the okex session.</p><p>And the second part is the exchange strategies, we defined one grid strategy on the okex exchange session.</p><p>We will explain the above parameters:</p><p>symbol means the market we want to trade.</p><p>quantity means how much quantity for each grid order.</p><p>gridNumber means how many grid orders do you want to place.</p><p>upperPrice means the highest price of this grid.</p><p>lowerPrice means the lowest price of this grid.</p><p>profitSpread means once your buy order is executed, what’s the profit spread of your sell order. for example, if you buy BTC at 46000 and your profit spread is 500, then it will place a BTC sell order at 46500 (46000 + 500).</p><p>The config files are ready, let’s download the bbgo binary from GitHub:</p><pre>curl -L -O <a href="https://github.com/c9s/bbgo/releases/download/v1.21.0/bbgo-slim-v1.21.0-24-gf78a7d37-linux-amd64.tar.gz">https://github.com/c9s/bbgo/releases/download/v1.21.0/bbgo-slim-v1.21.0-24-gf78a7d37-linux-amd64.tar.gz</a><br>tar xvf bbgo-slim-v1.21.0-24-gf78a7d37-linux-amd64.tar.gz<br>mv bbgo-slim-linux-amd64 bbgo</pre><p>And then we can start running bbgo!</p><pre>./bbgo run</pre><p>And that’s it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*A0lyfWiPxKQb4VGC4m1HHw.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd2f756d63e2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/bbgo/okex-grid-trading-with-bbgo-cd2f756d63e2">BBGO Grid Trading on OKEx</a> was originally published in <a href="https://medium.com/bbgo">BBGO</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>