Any premade way to distinguish between Source dashboard trades vs access_key

I know i might be able to assume a blank custom Client Order ID might be an easy identifier in code? Curious if there was another way, like kinda how the old dashboard knows which method I traded with.

@grathan The order object has info on ‘source’. Below are the attributes when fetching an order

‘id’, ‘client_order_id’, ‘created_at’, ‘updated_at’, ‘submitted_at’,
‘filled_at’, ‘expired_at’, ‘canceled_at’, ‘failed_at’, ‘replaced_at’,
‘replaced_by’, ‘replaces’, ‘asset_id’, ‘symbol’, ‘asset_class’,
‘notional’, ‘qty’, ‘filled_qty’, ‘filled_avg_price’, ‘order_class’,
‘order_type’, ‘type’, ‘side’, ‘time_in_force’, ‘limit_price’,
‘stop_price’, ‘status’, ‘extended_hours’, ‘legs’, ‘trail_percent’,
‘trail_price’, ‘hwm’, ‘subtag’, ‘source’

That last attribute source indicates how the order was placed. If it is ‘access_key’ then the order was placed via the API, if a long UUID alpha string (which looks like an order number) the order was placed via an OAuth app (eg TradingView) and that is the app client ID, if it is blank the order was placed via the dashboard. On rare occasion there may be other values which indicate the order was placed internally by Alpaca (eg to liquidate a position for a margin call).

So, simply look at order.source to determine how it was placed.

Hey thanks, do you know if there is anything for the C# wrapper for IOrder by chance? Or if the info you have there is attainable by REST?

@grathan I’m not very familiar with the C# SDK, but there should be methods to fetch both all orders and a single order. Both would return an order object. Order objects have a source attribute. Now that said, the C# SDK my somehow mask or not implement that attribute?

It’s definitely in the REST response. You can also see it on the orders page in the UI dashboard as shown below