Trading / Portfolio

Portfolio

We are in open beta

Everything related to lemon.markets is still very much work in progress. Please bear with us that some things are still a bit buggy or functionality is missing. We are really grateful if you share your feedback on Slack as this helps make lemon.markets a product we all want to use. Thank you :)

We believe that it is important to be able to keep a convenient overview over all positions that affect your portfolio. In general, an executed order triggers a portfolio change, whereby a buy order adds and a sell order removes something from/to your portfolio.

After you placed a few orders, you might be interested in seeing how our Portfolio looks like. Using the /portfolio endpoint, you can get in-depth information on all your portfolio items. In general, a portfolio item is the result of an executed order.

To list all your Portfolio positions, use the following request URLs:

https://paper-trading.lemon.markets/v1/portfolio/

to list your Paper Money Portfolio, and

https://trading.lemon.markets/v1/portfolio/

to list your Real Money Portfolio.

Request

Specify your request as follows:

Header Parameters

Authorization
string
required

Set your Authorization header in the format "Authorization: Bearer YOUR-API-KEY"

Query Parameters

isin
string
optional

Filter for a specific Instrument in your portfolio

space_id
string
optional

Filter for a specific Space in your portfolio

Response

Response Parameters

time
string

Timestamp of your request

status
string

Shows status "ok" when portfolio was successfully retrieved

mode
string

Environment the request was placed in: "paper" or "money"

space_id
string

Identification Number of the space you placed the order with

isin
string

International Securities Identification Number of instrument

isin_title
string

Title of instrument

quantity
int

Number of current Instrument items in your Portfolio

buy_quantity
int

Number of purchased Instrument items

sell_quantity
int

Number of sold Instrument items

buy_price_avg
int

Average buy-in price

buy_price_min
int

Minimum buy-in price

buy_price_max
int

Maximum buy-in price

buy_price_avg_historical
int

Average historical buy-in price

sell_price_min
int

Minimum sell price

sell_price_max
int

Maximum sell price

sell_price_avg_historical
int

Average historical sell price

orders_total
int

Total number of orders for Portfolio item

sell_orders_total
int

Total number of sell orders for Portfolio item

buy_orders_total
int

Total number of buy orders for Portfolio item

Check our Error Handling Page for specific information on error types.

Request

1import requests
2import json
3
4request = requests.get("https://paper-trading.lemon.markets/v1/portfolio/?isin=US88160R1014&space_id=sp_pyJKLffNNByV4m8rxtG4YnfGwKJGk3bnBy", headers={"Authorization": "Bearer YOUR-API-KEY"})
5print(request.json())
6      

Response

1{
2  "time":"2021-11-21T19:34:45.071+00:00",
3  "status": "ok",
4  "mode":"paper",
5  "results": [
6    {
7      "space_id": "sp_pyPFYssNNJyV4m8rxtK7LnfGwKLMk2njSv",
8      "isin": "US19260Q1076",
9      "isin_title": "COINBASE GLOBAL INC.",
10      "quantity": 1,
11      "buy_quantity": 1,
12      "sell_quantity": 0,
13      "buy_price_avg": 2965000,
14      "buy_price_min": 2965000,
15      "buy_price_max": 2965000,
16      "buy_price_avg_historical": 2965000,
17      "sell_price_min": null,
18      "sell_price_max": null,
19      "sell_price_avg_historical": null,
20      "orders_total": 1,
21      "sell_orders_total": 0,
22      "buy_orders_total": 1
23    },
24    {
25      "space_id": "sp_pyPFYssNNJyV4m8rxtK7LnfGwKLMk2njSv",
26      ...
27    }
28  ]
29}
30
31