adjustments to cli flags and sat factor
This commit is contained in:
parent
3ebc756a53
commit
e999a717e4
16
trade.py
16
trade.py
|
@ -112,7 +112,7 @@ class Trader(TradeOgre):
|
||||||
order.active = False
|
order.active = False
|
||||||
order.save()
|
order.save()
|
||||||
logging.info(f'Order {order.uuid} no longer active on TradeOgre. Setting inactive.')
|
logging.info(f'Order {order.uuid} no longer active on TradeOgre. Setting inactive.')
|
||||||
sleep(5)
|
sleep(3)
|
||||||
|
|
||||||
def start_market_maker(self):
|
def start_market_maker(self):
|
||||||
logging.info('[MARKET MAKER] Starting market maker')
|
logging.info('[MARKET MAKER] Starting market maker')
|
||||||
|
@ -127,8 +127,8 @@ class Trader(TradeOgre):
|
||||||
if latest.spread_sats > self.spread_target:
|
if latest.spread_sats > self.spread_target:
|
||||||
bid_amount = uniform(self.trade_amount, self.trade_amount * self.amount_multiplier)
|
bid_amount = uniform(self.trade_amount, self.trade_amount * self.amount_multiplier)
|
||||||
ask_amount = uniform(self.trade_amount, self.trade_amount * self.amount_multiplier)
|
ask_amount = uniform(self.trade_amount, self.trade_amount * self.amount_multiplier)
|
||||||
bid_price = '{:.8f}'.format(latest.bid + self.satoshi * 1000)
|
bid_price = '{:.8f}'.format(latest.bid + self.satoshi * 100)
|
||||||
ask_price = '{:.8f}'.format(latest.ask - self.satoshi * 1000)
|
ask_price = '{:.8f}'.format(latest.ask - self.satoshi * 100)
|
||||||
logging.info(f'[MARKET MAKER] Submitting buy order for {bid_amount} at {bid_price} {self.trade_pair}')
|
logging.info(f'[MARKET MAKER] Submitting buy order for {bid_amount} at {bid_price} {self.trade_pair}')
|
||||||
buy = self.submit_order('buy', self.trade_pair, bid_amount, bid_price)
|
buy = self.submit_order('buy', self.trade_pair, bid_amount, bid_price)
|
||||||
logging.debug(buy)
|
logging.debug(buy)
|
||||||
|
@ -168,6 +168,7 @@ if __name__ == '__main__':
|
||||||
parser.add_argument('--market-maker', action='store_true', help='Put in buy/sell orders')
|
parser.add_argument('--market-maker', action='store_true', help='Put in buy/sell orders')
|
||||||
parser.add_argument('--balances', action='store_true', help='Update coin balances of both base and currency')
|
parser.add_argument('--balances', action='store_true', help='Update coin balances of both base and currency')
|
||||||
parser.add_argument('--update-orders', action='store_true', help='Update status of orders')
|
parser.add_argument('--update-orders', action='store_true', help='Update status of orders')
|
||||||
|
parser.add_argument('--market-data', action='store_true', help='Update market data')
|
||||||
parser.add_argument('--run', action='store_true', help='Run continuously')
|
parser.add_argument('--run', action='store_true', help='Run continuously')
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
|
@ -176,16 +177,19 @@ if __name__ == '__main__':
|
||||||
balances_counter = 0
|
balances_counter = 0
|
||||||
market_maker_counter = 0
|
market_maker_counter = 0
|
||||||
|
|
||||||
if not args.run and args.market_maker:
|
|
||||||
t.start_market_maker()
|
|
||||||
|
|
||||||
if not args.run and args.update_orders:
|
if not args.run and args.update_orders:
|
||||||
t.reconcile_orders()
|
t.reconcile_orders()
|
||||||
t.update_orders()
|
t.update_orders()
|
||||||
|
|
||||||
|
if not args.run and args.market_maker:
|
||||||
|
t.start_market_maker()
|
||||||
|
|
||||||
if not args.run and args.balances:
|
if not args.run and args.balances:
|
||||||
t.store_balances()
|
t.store_balances()
|
||||||
|
|
||||||
|
if not args.run and args.market_data:
|
||||||
|
t.store_market_data()
|
||||||
|
|
||||||
if args.run:
|
if args.run:
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue