All URIs are relative to https://api-v2.upstox.com
Method | HTTP request | Description |
---|---|---|
convert_positions | PUT /portfolio/convert-position | Convert Positions |
get_holdings | GET /portfolio/long-term-holdings | Get Holdings |
get_positions | GET /portfolio/short-term-positions | Get Positions |
ConvertPositionResponse convert_positions(body, api_version)
Convert Positions
Convert the margin product of an open position
from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: OAUTH2
configuration = upstox_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration))
body = upstox_client.ConvertPositionRequest() # ConvertPositionRequest |
api_version = 'api_version_example' # str | API Version Header
try:
# Convert Positions
api_response = api_instance.convert_positions(body, api_version)
pprint(api_response)
except ApiException as e:
print("Exception when calling PortfolioApi->convert_positions: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
body | ConvertPositionRequest | ||
api_version | str | API Version Header |
- Content-Type: application/json
- Accept: /, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetHoldingsResponse get_holdings(api_version)
Get Holdings
Fetches the holdings which the user has bought/sold in previous trading sessions.
from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: OAUTH2
configuration = upstox_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration))
api_version = 'api_version_example' # str | API Version Header
try:
# Get Holdings
api_response = api_instance.get_holdings(api_version)
pprint(api_response)
except ApiException as e:
print("Exception when calling PortfolioApi->get_holdings: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
api_version | str | API Version Header |
- Content-Type: Not defined
- Accept: /, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
GetPositionResponse get_positions(api_version)
Get Positions
Fetches the current positions for the user for the current day.
from __future__ import print_function
import time
import upstox_client
from upstox_client.rest import ApiException
from pprint import pprint
# Configure OAuth2 access token for authorization: OAUTH2
configuration = upstox_client.Configuration()
configuration.access_token = 'YOUR_ACCESS_TOKEN'
# create an instance of the API class
api_instance = upstox_client.PortfolioApi(upstox_client.ApiClient(configuration))
api_version = 'api_version_example' # str | API Version Header
try:
# Get Positions
api_response = api_instance.get_positions(api_version)
pprint(api_response)
except ApiException as e:
print("Exception when calling PortfolioApi->get_positions: %s\n" % e)
Name | Type | Description | Notes |
---|---|---|---|
api_version | str | API Version Header |
- Content-Type: Not defined
- Accept: /, application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]