-
Notifications
You must be signed in to change notification settings - Fork 24
/
basis_trading.py
53 lines (40 loc) · 2.16 KB
/
basis_trading.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
'''
@Description: trading source
@Author: Yang Boyu
@Email: [email protected]
'''
import argparse
import ccxt
from Config import *
from BinanceArb import BinanceArbBot
def init_argparse():
parser = argparse.ArgumentParser()
parser.add_argument('--exchange', default=ccxt.binance(BINANCE_CONFIG), help='exchange')
parser.add_argument('--coin', type=str, default='ada'.upper())
parser.add_argument('--future_date', type=str, default='221230', help='expiration date')
parser.add_argument('--coin_precision', type=int, default=5, help="price precision")
parser.add_argument('--slippage', type=float, default=0.02, help="proportion of coin price")
parser.add_argument('--multiplier', type=dict, default=multiplier, help='expiration date')
# commissionRate
# BTC-related: 0; 25% off using BNB; BUSD pairs maker: 0
parser.add_argument('--spot_fee_rate', type=float, default=1/1000)
parser.add_argument('--contract_fee_rate', type=float, default=1/10000, help="maker: 0.01%, taker: 0.05%")
parser.add_argument('--max_trial', type=int, default=5, help="number of trials for connection")
return parser
if __name__ == '__main__':
# ***open positions***
position_parser = init_argparse()
position_parser.add_argument('--amount', type=int, default=20, help="spot trading amount for one iteration")
position_parser.add_argument('--num_maximum', type=int, default=3, help="maximum execution numbers")
position_parser.add_argument('-f', '--threshold', type=int, default=0.025, help="opening threshold")
args = position_parser.parse_args()
trading_bot = BinanceArbBot(**vars(args))
trading_bot.open_position()
# ***close positions***
# position_parser = init_argparse()
# position_parser.add_argument('--amount', type=float, default=10, help="number of coins for one iteration")
# position_parser.add_argument('--num_maximum', type=int, default=3, help="maximum execution numbers")
# position_parser.add_argument('--threshold', type=int, default=0.0005, help="closing threshold")
# args = position_parser.parse_args()
# trading_bot = BinanceArbBot(**vars(args))
# trading_bot.close_position()