All URIs are relative to https://api.bybit.com
| Method | HTTP request | Description |
|---|---|---|
| linear_positions_change_margin | POST /private/linear/position/add-margin | Add/Reduce Margin |
| linear_positions_close_pnl_records | GET /private/linear/trade/closed-pnl/list | Get user's closed profit and loss records. |
| linear_positions_my_position | GET /private/linear/position/list | Get my position list. |
| linear_positions_save_leverage | POST /private/linear/position/set-leverage | Set leverage |
| linear_positions_set_auto_add_margin | POST /private/linear/position/set-auto-add-margin | Set auto add margin |
| linear_positions_switch_isolated | POST /private/linear/position/switch-isolated | Switch isolated |
| linear_positions_switch_mode | POST /private/linear/tpsl/switch-mode | Switch Mode |
| linear_positions_trading_stop | POST /private/linear/position/trading-stop | Set tradingStop |
object linear_positions_change_margin(symbol=symbol, side=side, margin=margin)
Add/Reduce Margin
This will Add/Reduce Margin
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
side = 'side_example' # str | (optional)
margin = 1.2 # float | (optional)
try:
# Add/Reduce Margin
api_response = api_instance.linear_positions_change_margin(symbol=symbol, side=side, margin=margin)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_change_margin: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| side | str | [optional] | |
| margin | float | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_close_pnl_records(symbol=symbol, start_time=start_time, end_time=end_time, exec_type=exec_type, page=page, limit=limit)
Get user's closed profit and loss records.
This will get user's closed profit and loss records.
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
start_time = 789 # int | (optional)
end_time = 789 # int | (optional)
exec_type = 'exec_type_example' # str | (optional)
page = 789 # int | (optional)
limit = 789 # int | (optional)
try:
# Get user's closed profit and loss records.
api_response = api_instance.linear_positions_close_pnl_records(symbol=symbol, start_time=start_time, end_time=end_time, exec_type=exec_type, page=page, limit=limit)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_close_pnl_records: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| start_time | int | [optional] | |
| end_time | int | [optional] | |
| exec_type | str | [optional] | |
| page | int | [optional] | |
| limit | int | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_my_position(symbol=symbol)
Get my position list.
This will get my position list.
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
try:
# Get my position list.
api_response = api_instance.linear_positions_my_position(symbol=symbol)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_my_position: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/json, application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_save_leverage(symbol=symbol, buy_leverage=buy_leverage, sell_leverage=sell_leverage)
Set leverage
This will Set Leverage
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
buy_leverage = 1.2 # float | (optional)
sell_leverage = 1.2 # float | (optional)
try:
# Set leverage
api_response = api_instance.linear_positions_save_leverage(symbol=symbol, buy_leverage=buy_leverage, sell_leverage=sell_leverage)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_save_leverage: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| buy_leverage | float | [optional] | |
| sell_leverage | float | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_set_auto_add_margin(symbol=symbol, side=side, auto_add_margin=auto_add_margin)
Set auto add margin
This will Set auto add margin
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
side = 'side_example' # str | (optional)
auto_add_margin = true # bool | (optional)
try:
# Set auto add margin
api_response = api_instance.linear_positions_set_auto_add_margin(symbol=symbol, side=side, auto_add_margin=auto_add_margin)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_set_auto_add_margin: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| side | str | [optional] | |
| auto_add_margin | bool | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_switch_isolated(symbol=symbol, is_isolated=is_isolated, buy_leverage=buy_leverage, sell_leverage=sell_leverage)
Switch isolated
This will switch isolated
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
is_isolated = true # bool | (optional)
buy_leverage = 1.2 # float | (optional)
sell_leverage = 1.2 # float | (optional)
try:
# Switch isolated
api_response = api_instance.linear_positions_switch_isolated(symbol=symbol, is_isolated=is_isolated, buy_leverage=buy_leverage, sell_leverage=sell_leverage)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_switch_isolated: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| is_isolated | bool | [optional] | |
| buy_leverage | float | [optional] | |
| sell_leverage | float | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_switch_mode(symbol=symbol, tp_sl_mode=tp_sl_mode)
Switch Mode
This will Switch TP/SL Mode
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
tp_sl_mode = 'tp_sl_mode_example' # str | (optional)
try:
# Switch Mode
api_response = api_instance.linear_positions_switch_mode(symbol=symbol, tp_sl_mode=tp_sl_mode)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_switch_mode: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| tp_sl_mode | str | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]
object linear_positions_trading_stop(symbol=symbol, side=side, take_profit=take_profit, stop_loss=stop_loss, trailing_stop=trailing_stop, tp_trigger_by=tp_trigger_by, sl_trigger_by=sl_trigger_by, sl_size=sl_size, tp_size=tp_size)
Set tradingStop
This will set tradingStop
from __future__ import print_function
import time
import swagger_client
from swagger_client.rest import ApiException
from pprint import pprint
# Configure API key authorization: apiKey
configuration = swagger_client.Configuration()
configuration.api_key['api_key'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['api_key'] = 'Bearer'
# Configure API key authorization: apiSignature
configuration = swagger_client.Configuration()
configuration.api_key['sign'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['sign'] = 'Bearer'
# Configure API key authorization: timestamp
configuration = swagger_client.Configuration()
configuration.api_key['timestamp'] = 'YOUR_API_KEY'
# Uncomment below to setup prefix (e.g. Bearer) for API key, if needed
# configuration.api_key_prefix['timestamp'] = 'Bearer'
# create an instance of the API class
api_instance = swagger_client.LinearPositionsApi(swagger_client.ApiClient(configuration))
symbol = 'symbol_example' # str | (optional)
side = 'side_example' # str | (optional)
take_profit = 1.2 # float | (optional)
stop_loss = 1.2 # float | (optional)
trailing_stop = 1.2 # float | (optional)
tp_trigger_by = 'tp_trigger_by_example' # str | (optional)
sl_trigger_by = 'sl_trigger_by_example' # str | (optional)
sl_size = 1.2 # float | (optional)
tp_size = 1.2 # float | (optional)
try:
# Set tradingStop
api_response = api_instance.linear_positions_trading_stop(symbol=symbol, side=side, take_profit=take_profit, stop_loss=stop_loss, trailing_stop=trailing_stop, tp_trigger_by=tp_trigger_by, sl_trigger_by=sl_trigger_by, sl_size=sl_size, tp_size=tp_size)
pprint(api_response)
except ApiException as e:
print("Exception when calling LinearPositionsApi->linear_positions_trading_stop: %s\n" % e)| Name | Type | Description | Notes |
|---|---|---|---|
| symbol | str | [optional] | |
| side | str | [optional] | |
| take_profit | float | [optional] | |
| stop_loss | float | [optional] | |
| trailing_stop | float | [optional] | |
| tp_trigger_by | str | [optional] | |
| sl_trigger_by | str | [optional] | |
| sl_size | float | [optional] | |
| tp_size | float | [optional] |
object
apiKey, apiSignature, timestamp
- Content-Type: application/x-www-form-urlencoded
- Accept: application/json
[Back to top] [Back to API list] [Back to Model list] [Back to README]