|
|
|
@ -112,7 +112,7 @@ class Trader(TradeOgre):
|
|
|
|
|
order.active = False
|
|
|
|
|
order.save()
|
|
|
|
|
logging.info(f'Order {order.uuid} no longer active on TradeOgre. Setting inactive.')
|
|
|
|
|
sleep(5)
|
|
|
|
|
sleep(3)
|
|
|
|
|
|
|
|
|
|
def start_market_maker(self):
|
|
|
|
|
logging.info('[MARKET MAKER] Starting market maker')
|
|
|
|
@ -127,8 +127,8 @@ class Trader(TradeOgre):
|
|
|
|
|
if latest.spread_sats > self.spread_target:
|
|
|
|
|
bid_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)
|
|
|
|
|
ask_price = '{:.8f}'.format(latest.ask - self.satoshi * 1000)
|
|
|
|
|
bid_price = '{:.8f}'.format(latest.bid + self.satoshi * 100)
|
|
|
|
|
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}')
|
|
|
|
|
buy = self.submit_order('buy', self.trade_pair, bid_amount, bid_price)
|
|
|
|
|
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('--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('--market-data', action='store_true', help='Update market data')
|
|
|
|
|
parser.add_argument('--run', action='store_true', help='Run continuously')
|
|
|
|
|
args = parser.parse_args()
|
|
|
|
|
|
|
|
|
@ -176,16 +177,19 @@ if __name__ == '__main__':
|
|
|
|
|
balances_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:
|
|
|
|
|
t.reconcile_orders()
|
|
|
|
|
t.update_orders()
|
|
|
|
|
|
|
|
|
|
if not args.run and args.market_maker:
|
|
|
|
|
t.start_market_maker()
|
|
|
|
|
|
|
|
|
|
if not args.run and args.balances:
|
|
|
|
|
t.store_balances()
|
|
|
|
|
|
|
|
|
|
if not args.run and args.market_data:
|
|
|
|
|
t.store_market_data()
|
|
|
|
|
|
|
|
|
|
if args.run:
|
|
|
|
|
while True:
|
|
|
|
|
try:
|
|
|
|
|