Streaming feed
wscat
-H "Authorization: Bearer {token here}" -c wss://api.lime.co/accounts
Command examples
{ "action":"subscribeBalance","account":"12345678@vision" }
{ "action":"subscribePositions","account":"12345678@vision" }
{ "action":"subscribeOrders","account":"12345678@vision" }
{ "action":"subscribeTrades","account":"12345678@vision" }
{ "action":"unsubscribeBalance","account":"12345678@vision" }
{ "action":"unsubscribePositions","account":"12345678@vision" }
{ "action":"unsubscribeOrders","account":"12345678@vision" }
{ "action":"unsubscribeTrades","account":"12345678@vision" }
Feed example
{
"t":"p",
"data":[{
"account":"12345678@vision",
"positions":[{
"symbol":"AAPL",
"average_open_price":176.8450,
"current_price":187.0050,
"quantity":2,
"security_type":"common_stock"
},
{
"symbol":"AMC",
"average_open_price":8.2800,
"current_price":8.0650,
"quantity":10,
"security_type":"common_stock"
},
{
"symbol":"TSLA",
"average_open_price":233.4900,
"current_price":233.5412,
"quantity":-3,
"security_type":"common_stock"
}]
}]
}
{
"t":"b",
"data":[{
"account_number":"12345678@vision",
"trade_platform":"transaq",
"margin_type":"marginx2",
"restriction":"none",
"account_value_total":27009.0400,
"cash":419.78,
"margin_buying_power":27428.83,
"non_margin_buying_power":13714.41,
"position_market_value":26589.2550,
"unsettled_cash":0,
"cash_to_withdraw":13112.03
}]
}
{
"t":"o",
"data":[{
"account_number":"12345678@vision",
"client_id":"4596252142",
"client_order_id": "01HWYX297HG2J9V607VSY4GQ3S",
"exchange":"Zero Commission",
"quantity":1,
"executed_quantity":0,
"order_status":"new",
"price":378,
"stop_price":0,
"time_in_force":"day",
"order_type":"limit",
"order_side":"buy",
"symbol":"MA",
"executed_price":0,
"tag":"order #11"
}]
}
{
"t":"o",
"data":[{
"account_number":"12345678@vision",
"client_id":"4596252142",
"client_order_id": "01HX6NRN9A6E5N18QACA85BW4T",
"exchange":"auto",
"quantity":1,
"executed_quantity":1,
"order_status":"filled",
"price":378,
"stop_price":0,
"time_in_force":"day",
"order_type":"limit",
"order_side":"buy",
"symbol":"MA",
"executed_price":377.6392,
"executed_timestamp":1644258422,
"tag":""
}]
}
{
"t":"t",
"data":[{
"account_number":"12345678@vision",
"symbol":"MA",
"timestamp":1644258422,
"quantity":1,
"price":377.6392,
"amount":377.6392,
"side":"buy",
"trade_id":"24447436121"
}]
}
If authentication is denied the websocket connection is terminated immediately. The client should implement reconnection logic to maintain the opened connection. The server will disconnect after some inactivity period. Subscription command for an account that has already been subscribed is ignored. Same behavior applies to Unsubscribe. Any recognized command will result an Error sent back to the subscriber.
Request
The following commands are supported:
name | type | description |
---|---|---|
action | string | Required. Possible values are subscribeTrades , subscribeBalance , subscribePositions , subscribeOrders |
account | string | Required. The account number |
Response
Position
The server sends a full list of positions for all subscribed accounts on each update of any field value. Since during market hours the prices keep changing the update is going to be sent on each throttling period
name | type | description |
---|---|---|
t | string | Type p |
data | array | An array of structures where account is an account number and positions is an array of position structures |
symbol | string | The security symbol |
quantity | number | Signed number of shares or option contracts |
average_open_price | number | Average historical cost basis |
current_price | number | Current price |
security_type | string | Asset type. Possible values are common_stock , preferred_stock , option |
Balance
The server sends a full list of balance for all subscribed accounts on each update of any field value. Since during market hours the prices keep changing the update is going to be sent on each throttling period
name | type | description |
---|---|---|
t | string | Type b |
data | array | An array of balance structures |
account_number | string | The account number |
trade_platform | string | The trading platform this account is traded on |
margin_type | string | The margin type, possible values are cash , marginx1 , marginx2 , daytrader |
restriction | string | Restriction level effective on the account, possible values are none - no restrictions, restricted - opening transactions are not allowed but closing orders are accepted, disabled - no activity is allowed in the account, closed - the account is closed |
restriction_reason | string | Optional description explaining why the account is restricted |
account_value_total | number | Total account liquidation value |
cash | number | Account debit balance when negative, credit balance when positive |
day_trading_buying_power | number | Day trading buying power for marginable securities |
margin_buying_power | number | The buying power for marginable securities |
non_margin_buying_power | number | The buying power for non-marginable securities |
position_market_value | number | Sum of all positions current market values. The value is negative for short positions |
unsettled_cash | number | Unsettled cash for cash accounts |
cash_to_withdraw | number | Cash available to withdraw from the account |
Order
The server sends a notification when an order changes status. After initial connection, the server sends a list of all orders in current status on current trading day.
name | type | description |
---|---|---|
t | string | Type o |
data | array | An array of order structures |
account_number | string | The account number |
client_id | string | The order id |
client_order_id | string | The client order id |
exchange | string | The routing instructions |
quantity | number | Positive integer, number of shares, options contracts or multi-leg orders |
executed_quantity | number | Positive number of shares or contracts executed by this time |
order_status | string | The order status. Possible values are pending_new , new , partially_filled , filled , replaced , done_for_day , pending_cancel , canceled , rejected , suspended |
price | number | Limit price if applicable |
stop_price | number | Stop price is applicable |
time_in_force | string | Order duration instructions. Possible values are day - regular hours, ext - extended hours, on-open - opening auction, on-close - closing auction, ioc - immediate or cancel, fok - fill or kill |
order_type | string | The order type. Possible values are limit , market |
order_side | string | Side of the order. Possible values are buy , sell |
symbol | string | The security symbol |
executed_price | number | The average price of execution, only populated when an order has been executed, partially or fully |
executed_timestamp | number | Unix time stamp of the last execution, only populated when an order has been executed, partially or fully |
tag | string | Order tag if specified |
legs | array | Array of legs in a multi-leg order |
Legs array element:
name | type | description |
---|---|---|
symbol | string | Leg security symbol |
quantity | number | Positive integer, leg ratio quantity |
side | string | Side of the leg. Available values are buy and sell |
Trade
The server sends a notification when a trade executes. After initial connection, the server sends a list of all trades on current trading day.
name | type | description |
---|---|---|
t | string | Type t |
data | array | An array of trade structures |
account_number | string | The account number |
symbol | string | The security symbol |
timestamp | number | Unix time stamp of the trade |
quantity | number | Number of shares or option contracts, negative for sells, positive for buys |
price | number | The trade price |
amount | number | The trade amount, which is the quantity multiplied by the lot size and price |
side | string | The trade side. Possible values are buy or sell |
trade_id | string | The trade id |
Error
name | description |
---|---|
t | Type e |
code | Error code |
description | Error description |