forked from Dave-Vallance/bt-ccxt-store
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'make_initial_fetch_balance_optional_for_feed'
- Loading branch information
Showing
7 changed files
with
195 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import time | ||
from datetime import datetime | ||
|
||
import backtrader as bt | ||
|
||
from ccxtbt import CCXTFeed | ||
|
||
|
||
def main(): | ||
class TestStrategy(bt.Strategy): | ||
def __init__(self): | ||
self.next_runs = 0 | ||
|
||
def next(self, dt=None): | ||
dt = dt or self.datas[0].datetime.datetime(0) | ||
print('%s closing price: %s' % (dt.isoformat(), self.datas[0].close[0])) | ||
self.next_runs += 1 | ||
|
||
cerebro = bt.Cerebro() | ||
|
||
cerebro.addstrategy(TestStrategy) | ||
|
||
# Add the feed | ||
cerebro.adddata(CCXTFeed(exchange='binance', | ||
dataname='BNB/USDT', | ||
timeframe=bt.TimeFrame.Minutes, | ||
fromdate=datetime(2019, 1, 1, 0, 0), | ||
todate=datetime(2019, 1, 1, 0, 2), | ||
compression=1, | ||
ohlcv_limit=2, | ||
currency='BNB', | ||
retries=5, | ||
|
||
# 'apiKey' and 'secret' are skipped | ||
config={'enableRateLimit': True, 'nonce': lambda: str(int(time.time() * 1000))})) | ||
|
||
# Run the strategy | ||
cerebro.run() | ||
|
||
|
||
if __name__ == '__main__': | ||
main() |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
Oops, something went wrong.