コード例 #1
0
 def __create_order__(self, order: Order,
                      is_order_simulation: bool) -> OrderStatus:
     suffix = self.get_simulation_suffix(is_order_simulation)
     print_prefix = '{}: Order executed{} for {}:'.format(
         order.side_type, suffix, order.symbol)
     if self.is_transaction_simulation(is_order_simulation):
         if order.type == OT.EXCHANGE_MARKET:
             order.price = order.actual_ticker.ask
         return BitfinexFactory.get_order_status_by_order_for_simulation(
             self.exchange_config, order)
     else:
         payload_additional = {
             'symbol': order.symbol.lower(),
             'amount': str(order.amount),
             'price': str(order.price),
             'exchange': 'bitfinex',
             'side': order.side,
             'type': order.type
         }
         json_resp = self.__get_json__('/order/new', payload_additional)
         print('__create_order__: json_resp={}'.format(json_resp))
         if 'order_id' in json_resp:
             order_status = BitfinexFactory.get_order_status_by_json_dict(
                 self.exchange_config, json_resp['order_id'], json_resp)
             self.__correct_executed_amount__(order_status)
             order_status.print_order_status(print_prefix)
             self.balance_cache.clear(
             )  # the next call has to get the updated balances...
             return order_status
         else:
             order.print_order('Error create_order: {}'.format(
                 json_resp['message']))
コード例 #2
0
 def __init__(self, symbol: str, amount: float, price_distance: float):
     api = OrderApi(symbol, amount, price=price_distance)
     api.side = OS.SELL
     api.type = OT.EXCHANGE_TRAILING_STOP
     Order.__init__(self, api)
コード例 #3
0
 def __init__(self, symbol: str, amount: float, limit: float):
     api = OrderApi(symbol, amount, price=limit)
     api.side = OS.SELL
     api.type = OT.EXCHANGE_LIMIT
     Order.__init__(self, api)
コード例 #4
0
 def __init__(self, symbol: str, amount: float, stop_price: float):
     api = OrderApi(symbol, amount, price=stop_price)
     api.side = OS.SELL
     api.type = OT.EXCHANGE_STOP
     Order.__init__(self, api)
コード例 #5
0
 def __init__(self, symbol: str, amount: float):
     api = OrderApi(symbol, amount)
     api.price = 1.00
     api.side = OS.SELL
     api.type = OT.EXCHANGE_MARKET
     Order.__init__(self, api)