Skip to content

Latest commit

 

History

History
168 lines (117 loc) · 4.86 KB

PortfolioApi.md

File metadata and controls

168 lines (117 loc) · 4.86 KB

upstox_client.PortfolioApi

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

convert_positions

ConvertPositionResponse convert_positions(body, api_version)

Convert Positions

Convert the margin product of an open position

Example

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)

Parameters

Name Type Description Notes
body ConvertPositionRequest
api_version str API Version Header

Return type

ConvertPositionResponse

Authorization

OAUTH2

HTTP request headers

  • Content-Type: application/json
  • Accept: /, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_holdings

GetHoldingsResponse get_holdings(api_version)

Get Holdings

Fetches the holdings which the user has bought/sold in previous trading sessions.

Example

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)

Parameters

Name Type Description Notes
api_version str API Version Header

Return type

GetHoldingsResponse

Authorization

OAUTH2

HTTP request headers

  • Content-Type: Not defined
  • Accept: /, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]

get_positions

GetPositionResponse get_positions(api_version)

Get Positions

Fetches the current positions for the user for the current day.

Example

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)

Parameters

Name Type Description Notes
api_version str API Version Header

Return type

GetPositionResponse

Authorization

OAUTH2

HTTP request headers

  • Content-Type: Not defined
  • Accept: /, application/json

[Back to top] [Back to API list] [Back to Model list] [Back to README]