Closed dgurudot closed 2 years ago
@dgurudot Hi~ Could you be more specific on the transaction API? which one do you mean?
Example output:
{"type":"BUY","symbol":"NIO","amount":0.3959776627985088,"price":-1950.11,"cost":-1950.11,"netAmount":-772.2,"transactionDate":"2021-05-03 18:13:55","transactionId":"69GM38N6438P4N5NF2NT3GR4LA","description":"Bought NIO","commission":0,"fee":0}
We are using the activity endpoint and not able to figure out the total quantity of stock BUY and SELL from this response.
Really appreciate your help.
@dgurudot
After you do a result = place_order(buy[...])
you will get a result with combo_id.
You then use the order Id to check the details.:
result = wb.place_order(stock='AAPL', price=100.0, action='BUY', quant=1)
print(result)
output: {'success': True, 'data': {'orderId': 4237xxxxxxx492160}}
orders = wb.get_history_orders()
for order in orders :
if str(order['orders'][0]['orderId']) == '4237xxxxxxx492160' :
print(order)
output:
{'comboTickerType': 'stock', 'outsideRegularTradingHour': True, 'orders': [{'orderId': 4237xxxxxxx492160, 'tickerType': 'EQUITY', 'ticker': {'tickerId': 913256135, 'symbol': 'AAPL', 'name': 'Apple', 'tinyName': 'Apple', 'listStatus': 1, 'exchangeCode': 'NSQ', 'exchangeId': 96, 'type': 2, 'regionId': 6, 'currencyId': 247, 'currencyCode': 'USD', 'secType': [61], 'disExchangeCode': 'NASDAQ', 'disSymbol': 'AAPL'}, 'action': 'BUY', 'orderType': 'LMT', 'lmtPrice': '100.00', 'totalQuantity': '1', 'tickerId': 913256135, 'timeInForce': 'GTC', 'optionExercisePrice': '0.00', 'filledQuantity': '0', 'entrustType': 'QTY', 'placeAmount': '0', 'filledAmount': '0', 'remainAmount': '0', 'statusCode': 'Cancelled', 'statusStr': 'Cancelled', 'symbol': 'AAPL', 'optionContractMultiplier': '0', 'createTime0': 1615479756000, 'createTime': '03/11/2021 11:22:36 EST', 'canModify': False, 'canCancel': False, 'assetType': 'stock', 'brokerId': 8, 'remainQuantity': '1', 'updateTime': '03/11/2021 11:25:49 EST', 'updateTime0': 1615479949000, 'relation': 'normal', 'tickerPriceDefineList': [{'tickerId': 913256135, 'rangeBegin': '0', 'containBegin': True, 'rangeEnd': '1', 'containEnd': False, 'priceUnit': '0.0001'}, {'tickerId': 913256135, 'rangeBegin': '1', 'containBegin': True, 'containEnd': True, 'priceUnit': '0.01'}]}], 'quantity': '1', 'filledQuantity': '0', 'action': 'BUY', 'status': 'Cancelled', 'statusStr': 'Cancelled', 'timeInForce': 'GTC', 'orderType': 'LMT', 'lmtPrice': '100.00', 'canModify': False, 'canCancel': False}
Can you please check the JSON response from transaction API and see if it is providing quantity information ?
We started getting updated response from last week and not able to see quantity which makes it difficult to compute profits.
Please help if some header or something else needs to be updated.