-
-
Notifications
You must be signed in to change notification settings - Fork 93
How to get AssetClass & OrderStatus of an order #153
Hi All,
I am porting a small trader application from TDA to Alpaca and facing few small issues. I am using @Petersoj latest from github and getting a list of live orders. The orders show correctly in Alpaca site and I am getting the details. However when I query order.getAssetClass(), I am getting null which is probably ok since it is @nullable. But I still need the assetClass to construct my record. Am I doing something wrong or how to get this? Code below:
net.jacobpeterson.alpaca.openapi.trader.model.AssetClass assetClass = alpacaOrder.getAssetClass();
if(assetClass == null) {
//load assets in alternate way
}
//else valid class. process with record creation.
The order details:
class Order {
id: 98e5ec42-1c03-4cf5-9399-4519a7175***
clientOrderId: 49d30939-5909-474f-8de5-8ac83f665***
createdAt: 2024年05月06日T03:01:59.100343780Z
updatedAt: 2024年05月06日T03:01:59.100698280Z
submittedAt: 2024年05月06日T03:01:59.100343780Z
filledAt: null
expiredAt: null
...
assetId: 80e04a93-e1a8-4503-ab61-2ef1992650b4
symbol: PLTR
assetClass: null
qty: 2
filledQty: 0
orderClass: null
orderType: market
type: null
side: null
timeInForce: null
status: null
extendedHours: false
legs: null
}
The actual order screenshot is attached below. Please help.
2024年05月05日 20_27_54-Alpaca — PLTR 23 52
All reactions
I'll have to investigate this further when I have the time, but perhaps as a temporary mitigation, you can directly use the assets endpoint to get a mapping between asset classes and symbols instead of relying on the asset class to be present in the Order response data.
Replies: 1 comment 1 reply
I'll have to investigate this further when I have the time, but perhaps as a temporary mitigation, you can directly use the assets endpoint to get a mapping between asset classes and symbols instead of relying on the asset class to be present in the Order response data.
All reactions
Sure. Will do that.
Thank you.
All reactions
-
👍 1