self.calc_open(Type.SHORT, localtime, candle.close, 0) if __name__ == '__main__': params = utils.parse_param_map(sys.argv[1:]) year = 2019 test_bot = Bot( None, symbol='BTCUSDT', candle_limit=30, candle_period='1h', test_start=f'{year}-01-01', test_end=f'{year}-12-31', test_data='../candle_data/BINANCE_BTCUSDT, 60.csv', ) real_bot = Bot(BinanceAPI(), symbol='BTCUSDT', candle_limit=30, backtest=False, candle_period='1m') algo = MaCrossGo(base='BTC', quote='USDT', floor_decimals=3, paper=True, init_capital=10000, max_budget=1000000, commission_rate=0.1) # asyncio.run(test_bot.run(algo)) asyncio.run(real_bot.run(algo))
import time import os from futuremaker.binance_api import BinanceAPI symbol = 'BTCUSDT' api = BinanceAPI() def loan_test(): # asset = 'USDT' asset = 'BTC' amount = 0.003 ret = api.create_loan(asset, amount) print(ret) time.sleep(20) ret = api.repay_loan(asset, amount) print(ret) def loan_and_buy(): asset = 'USDT' amount = 40 ret = api.create_loan(asset, amount) print(ret) ret = api.create_buy_order(symbol, quantity=0.003) print(ret) def close_buy(): asset = 'USDT'
import time import os from futuremaker.binance_api import BinanceAPI symbol = 'BTCUSDT' key = os.getenv('key') secret = os.getenv('secret') api = BinanceAPI(key, secret) def loan_test(): # asset = 'USDT' asset = 'BTC' amount = 0.003 ret = api.create_loan(asset, amount) print(ret) time.sleep(20) ret = api.repay_loan(asset, amount) print(ret) def loan_buy_and_close(): asset = 'USDT' amount = 40 ret = api.create_loan(asset, amount) print(ret) ret = api.create_buy_order(symbol, quantity=0.003) print(ret)
# 4. 숏 포지션 손절. if self.position_quantity < 0: if candle.close > min(candle.short_break, self.position_losscut_price) > candle.open: # 숏 라인을 뚫고 올라올때. min을 사용하여 빠른 손절. if (localtime - self.position_entry_time).days >= 1: quantity = self.close_short() self.calc_close(localtime, candle.close, self.position_entry_price, -quantity) if __name__ == '__main__': params = utils.parse_param_map(sys.argv[1:]) year = 2018 test_bot = Bot(None, symbol='BTCUSDT', candle_limit=24 * 7 * 2, candle_period='1h', test_start=f'{year}-01-01', test_end=f'{year}-12-31', test_data='../candle_data/BINANCE_BTCUSDT, 60.csv', # test_data='../candle_data/BITFINEX_BTCUSD, 120.csv' # test_data='../candle_data/BINANCE_ETCUSDT, 60.csv', # test_data='../candle_data/BITFINEX_ETHUSD, 60.csv', ) real_bot = Bot(BinanceAPI(), symbol='BTCUSDT', candle_limit=24 * 7 * 2, backtest=False, candle_period='4h', ) algo = WeekBreakout(base='BTC', quote='USDT', floor_decimals=3, init_capital=1000, max_budget=1000000, week_start=Yoil.MON, hour_start=0, long_rate=0.6, short_rate=0.5, buy_unit=0.01, buy_delay=1, commission_rate=0.1, paper=True) asyncio.run(test_bot.run(algo)) # asyncio.run(real_bot.run(algo))