Example #1
0
 def cancelBuy(self):
     try:
         r.cancel_crypto_order(self.coin.lastBuyOrderID)
         return 0
     except:
         print("Failed to cancel, retrying")
         return -1
 def cancelOrder(self, orderID):
     self.output("Swing and miss, cancelling order " + orderID)
     try:
         cancelResult = r.cancel_crypto_order(orderID)
         print(str(cancelResult))
     except:
         self.output("Got exception canceling order, will try again.")
         return False
     return True
 def cancelOrder(self, orderID):
     print('Swing and miss, cancelling order ' + orderID)
     try:
         cancelResult = r.cancel_crypto_order(orderID)
         print(str(cancelResult))
     except:
         print('Got exception canceling order, will try again.')
         return False
     return True
Example #4
0
    def cancel_order( self, order_id ):
        if ( not config[ 'debug_enabled' ] ):
            try:
                cancelResult = rh.cancel_crypto_order( order_id )
            except:
                print( 'Got exception canceling order, will try again.' )
                return False

        return True
Example #5
0
 def cancel_old_crypto_orders(self, age=DEFAULT_STALE_ORDER_AGE):
     to_remove = set()
     # if DEBUG_INFO: pprint(self.order_ids)
     for t in self.order_ids.keys():
         if time.time() - t > DEFAULT_STALE_ORDER_AGE:
             info = rh.cancel_crypto_order(self.order_ids[t])
             # if DEBUG_INFO: pprint(info)
             to_remove.add(t)
     for t in to_remove:
         del self.order_ids[t]
Example #6
0
    def cancel_order(self, order_id):
        if (not config['simulate_api_calls']):
            try:
                cancelResult = rh.cancel_crypto_order(order_id)
                self.orders[order_id].status = 'cancelled'
                print('Cancelled order #' + str(order_id) + '.')
            except:
                print(
                    'An exception occurred while attempting to cancel order #'
                    + str(order_id) + '.')
                return False

        # Let Robinhood process this transaction
        sleep(10)

        return True
def cancel(ident):
    cancel = r.cancel_crypto_order(ident)
#     print(cancel)
    return cancel