Simple

Question about order placement

Programming


I am able to place order and got this error "Invalid order is rejected due to insufficient capital

Here is my code. Please help! 

res = self.evt.getContractSpec("SPYUS")
lot_size = res["contractSize"]
order = AlgoAPIUtil.OrderObject(
    instrument=md.instrument,
    buysell=1,
    volume=lot_size,
    ordertype=0,
    openclose='open'
)
self.evt.sendOrder(order)

 
tony lam

The res["contractSize"] refers to the number of shares for each lot of the ticker. 

The order.volume refers to the number of lot or contract you want to trade

  •  If you want to trade 1 lot, you can simply set order.volume = 1
  • If you want to trade only 1 share, you can set order.volume = 1/ res["contractSize"]