# ------------- POST ORDERS ------------------------------- # BUY order['direction'] = 'buy' order['price'] = my_bid buy_response = pos.stock_order(order) # SELL order['direction'] = 'sell' order['price'] = my_ask sell_response = pos.stock_order(order) # ----------------------------------------------------------- # ADD ORDER IDs TO OPEN ORDER LIST # order_id = buy_response['id'] try: pos.append(buy_response['id']) pos.append(sell_response['id']) except: KeyError # UPDATE OPEN ORDERS AND POSITION pos.check_fills() # PRINT info print('Quantity is: ', pos.qty) val = pos.calc_val() print('Position value is: ${:.2f}', val/100) print('Cash is: ${:.2f}'.format(pos.cash/100)) profit = (pos.cash + val)/100 print('Profit is: ${:.2f}'.format(profit))