Skip to content

API Reference

Shravan Jambukesan edited this page Mar 5, 2020 · 1 revision

Users API

POST: /api/Register

Create a new User with a username and password in JSON body like such:

{ "username": "trader1", "password": "test12345" }

POST: /api/Login

Login with the same input you provided during the Register call, you will receive a JSON response with your access token as such:

{ "id": 9, "userID": 10, "token": "TOKEN_HERE" }

Quotes API

GET: /api/Quotes/LatestPrice/{Symbol}

Retrieve the latest bid or quote price for a equity or ETF, for example to get the latest price for Apple stock it would be GET /api/Quotes/LatestPrice/AAPL. You will receive a response with the symbol name, price, timestamp, and source:

{ "symbol": "AAPL", "price": 273.36, "timestamp": "2020-03-01T21:44:39.5219259-06:00", "source": "Alpha Vantage Global Quote" }

GET: api/Quotes/SmartQuote/{Symbol}

Retrieve the best price across multiple sources to simulate optimized order routing. We use data from IEX TOPS (best bid price), Alpha Vantage Global Quote, and Twelve Data Time Series (latest closing price). The data is returned in the exact same format as LatestQuote. This endpoint is used internally by the Trade API to fetch the best quoted price for trade execution.

IMPORTANT NOTE

Multiple data providers are used across the Quote APIs. For LatestPrice, IEX TOPS best bid price is the preferred data source during intra-day trading and quote lookup, whereas Twelve Data is the fall back for after hours and in the event that IEX TOPS is unavailable during the day. The SmartQuote endpoint gets the best price across multiple sources, so far we are using IEX, Alpha Vantage, and Twelve Data with the possibility that more sources will be added in the future to simulate an optimized order route to difference market makers during trade execution via the Trade API.

Trading API

POST: /api/Trade/Execute

Execute trades (BUYs and SELLs) for a specific equity or ETF for your account You'll need to provide order input in the body of the request like so:

{ "Token": "YOUR_TOKEN_HERE", "Symbol": "SLYG", "Quantity": 10, "Type": "BUY" }

On successful order, you will receive a response like so:

{ "id": 8, "symbol": "SLYG", "type": "BUY", "price": 57.81, "quantity": 10, "date": "2020-03-01T21:31:30.1444081-06:00", "transactionID": "TRANSACTION_ID_HERE" }

Account API

POST: /api/Account/Positions Get all positions for an account. Provide the token in the request body:

{ "Token": "YOUR_TOKEN_HERE" }

You will receive a list of positions in the response:

[ { "id": 3, "accountId": 4, "orderId": 4, "value": 3240.2, "symbol": "MSFT", "quantity": 20 }, { "id": 5, "accountId": 4, "orderId": 8, "value": 578.1, "symbol": "SLYG", "quantity": 10 } ]

POST: /api/Account/Summary

Get an summary for an account including balance, values, and number of positions held. Provide the token in the same input body format used in the Positions API. You will get a response like such:

{ "accountId": 4, "accountBalance": 987475.2900000002, "totalInvestedValue": 3818.2999999999997, "totalCurrentValue": 578.1, "investmentGainOrLoss": -3240.2, "numberOfPositions": 2 }

Clone this wiki locally