Search position by symbol


How can I search/find existing positions by symbol? e.g. If I already have position in MNQ , I want to check current position before buying or selling more MNQ. Cant find API for this.

I don’t know of a way to pull positions by contract directly, but position/list will grab every position, and positions include a contractId item you could filter/sort with.

If you don’t have a specific contractId to filter by, you could search for any MNQ contract expiration month/year by using contract/suggest with a large number for the maximum entities to return. Running it for “MNQ” gave me contracts for MNQU1, MNQZ1, MNQH2, MNQM2, MNQU2, and MNQZ2. The “id” field from contract/suggest is the contractId from before.

Someone else may be able to comment on if position/find does this quicker. I’ve not tried it yet.

Thanks for the input @Brady.

Yes , I saw position/list and I would have to iterate over positions and look for contract id. When I place order , the response also has contact id which I can then match with position/list response. But I wanted to know if there is direct way to get this. Since tradovate UI shows positions with Symbol.

Tried position/find also, however I am not sure what the name is in this case. passing name as MNQZ1 fails.

The way that the Trader application gets its position data is by listening to the user/syncRequest real-time data stream. Once you’ve started the sync request subscription, every time you make an action that modifies a user property (ex. create or update a position) you will receive an event on the WebSocket. Events have a d field for event data payload, and an e field that tells you the type. For user data the e is "props".

Here’s an example of what a user sync d event data payload looks like:

  "eventType": "Updated",
  "entity": {
    "id": 12345,
    "accountId": 123456,
    "timestamp": "2019-08-24T14:15:22Z",
    "tradeDate": {
      "year": 0,
      "month": 0,
      "day": 0
    "currencyId": 0,
    "amount": 0,
    "realizedPnL": 0,
    "weekRealizedPnL": 0

This one is for CashBalance's but they all have the same structure. eventType is the CRUD (you really only get ‘Create’ or ‘Update’) operation performed. entityType is whatever entity category the event is regarding - you can see all of the entity types in the docs for userSync response. Expand the responses detail to see all the different entity types you could be receiving. Finally, entity is the actual entity instance that was updated. The schema of each entity will match the schema of the corresponding type in the docs link above.