increase_position
Classes¶
IncreasePosition ¶
Functions¶
__init__ ¶
__init__(asset_tick_step, increase_position_type, long_short, market_fee_pct, max_asset_size, min_asset_size, price_tick_step, sl_strategy_type)
Summary
Creates and sets the increase position class settings
Parameters:
Name | Type | Description | Default |
---|---|---|---|
asset_tick_step |
float
|
asset_tick_step |
required |
increase_position_type |
IncreasePositionType
|
How you want to process increasing your position |
required |
long_short |
str
|
long or short |
required |
market_fee_pct |
float
|
market_fee_pct |
required |
max_asset_size |
float
|
max_asset_size |
required |
min_asset_size |
float
|
min_asset_size |
required |
price_tick_step |
float
|
price_tick_step |
required |
sl_strategy_type |
StopLossStrategyType
|
how you want to process creating your stop loss |
required |
c_pl_ra_ps ¶
c_pl_ra_ps(equity, total_trades)
Summary
Creates possible loss then checks if it is bigger than risk account percent size then returns the new possible loss and total trades
Parameters:
Name | Type | Description | Default |
---|---|---|---|
equity |
float
|
equity |
required |
total_trades |
int
|
total_trades |
required |
Returns:
Type | Description |
---|---|
(int, int)
|
total_possible_loss, total_trades |
c_too_b_s ¶
c_too_b_s(entry_size_asset)
Summary
Check if the asset size is too big or too small
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry_size_asset |
float
|
entry size of the asset |
required |
c_total_trades ¶
c_total_trades(average_entry, position_size_asset, sl_price, total_trades)
Summary
Creates possible loss then adds 1 to total trades then checks if total trades is bigger than max trades
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
position_size_asset |
float
|
position_size_asset |
required |
sl_price |
float
|
sl_price |
required |
total_trades |
int
|
total_trades |
required |
Returns:
Type | Description |
---|---|
tuple[int, int]
|
total_possible_loss, total_trades |
long_entry_size_np ¶
long_entry_size_np(entry_price, sl_price, total_possible_loss)
Summary
Formula to calulcate the long entry size when we are not in a position and have our stop loss type set to stop loss based on candle body
how to calculate pnl https://www.bybithelp.com/en-US/s/article/Profit-Loss-calculations-USDT-Contract
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry_price |
float
|
entry_price |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
Returns:
Type | Description |
---|---|
float
|
entry_size_usd |
long_entry_size_p ¶
long_entry_size_p(average_entry, entry_price, position_size_usd, sl_price, total_possible_loss)
Summary
Formula to calulcate the long entry size when we are in a position and have our stop loss type set to stop loss based on candle body
how to calculate pnl https://www.bybithelp.com/en-US/s/article/Profit-Loss-calculations-USDT-Contract
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
entry_price |
float
|
entry_price |
required |
position_size_usd |
float
|
position_size_usd |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
Returns:
Type | Description |
---|---|
float
|
entry_size_usd |
min_amount_np ¶
min_amount_np(entry_price, sl_price)
Summary
Setting the entry size to the minimum amount
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry_price |
float
|
entry_price |
required |
sl_price |
float
|
sl_price |
required |
Returns:
Type | Description |
---|---|
tuple[float, float, float, float, float, float, int, int, float]
|
average_entry, entry_price, entry_size_asset, entry_size_usd, position_size_asset, position_size_usd, total_possible_loss, total_trades, sl_pct |
min_amount_p ¶
min_amount_p(average_entry, entry_price, position_size_asset, position_size_usd, sl_price, total_trades)
Summary
Setting the entry size to the minimum amount plus what ever position size we are already in
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
entry_price |
float
|
entry_price |
required |
position_size_asset |
float
|
position_size_asset |
required |
position_size_usd |
float
|
position_size_usd |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
total_trades |
int
|
total_trades |
required |
Returns:
Type | Description |
---|---|
tuple[float, float, float, float, float, float, int, int, float]
|
average_entry, entry_price, entry_size_asset, entry_size_usd, position_size_asset, position_size_usd, total_possible_loss, total_trades, sl_pct |
min_asset_amount ¶
min_asset_amount(average_entry, entry_price, equity, position_size_asset, position_size_usd, sl_price, total_trades)
Summary
Check if we are in a position or not and sending you to the correct function to handle that
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
entry_price |
float
|
entry_price |
required |
equity |
float
|
equity |
required |
position_size_asset |
float
|
position_size_asset |
required |
position_size_usd |
float
|
position_size_usd |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
total_trades |
int
|
total_trades |
required |
Returns:
Type | Description |
---|---|
(float, float, float, float, float, float, int, int, float)
|
average_entry, entry_price, entry_size_asset, entry_size_usd, position_size_asset, position_size_usd, total_possible_loss, total_trades, sl_pct |
rpa_slbcb ¶
rpa_slbcb(equity, average_entry, entry_price, position_size_asset, position_size_usd, sl_price, total_trades)
Summary
Check if we are in a position or not and sending you to the correct function to handle that
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
entry_price |
float
|
entry_price |
required |
equity |
float
|
equity |
required |
position_size_asset |
float
|
position_size_asset |
required |
position_size_usd |
float
|
position_size_usd |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
total_trades |
int
|
total_trades |
required |
Returns:
Type | Description |
---|---|
(float, float, float, float, float, float, int, int, float)
|
average_entry, entry_price, entry_size_asset, entry_size_usd, position_size_asset, position_size_usd, total_possible_loss, total_trades, sl_pct |
rpa_slbcb_np ¶
rpa_slbcb_np(equity, entry_price, sl_price)
Summary
Not in a position - Risking a percent of your account while also having your stop loss type set to stop loss based on candle body
Parameters:
Name | Type | Description | Default |
---|---|---|---|
equity |
float
|
equity |
required |
entry_price |
float
|
entry_price |
required |
sl_price |
float
|
sl_price |
required |
Returns:
Type | Description |
---|---|
tuple[float, float, float, float, float, float, int, int, float]
|
average_entry, entry_price, entry_size_asset, entry_size_usd, position_size_asset, position_size_usd, total_possible_loss, total_trades, sl_pct |
rpa_slbcb_p ¶
rpa_slbcb_p(average_entry, entry_price, equity, position_size_asset, position_size_usd, sl_price, total_trades)
Summary
In a position - Risking a percent of your account while also having your stop loss type set to stop loss based on candle body
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
entry_price |
float
|
entry_price |
required |
equity |
float
|
equity |
required |
position_size_asset |
float
|
position_size_asset |
required |
position_size_usd |
float
|
position_size_usd |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
total_trades |
int
|
total_trades |
required |
Returns:
Type | Description |
---|---|
(float, float, float, float, float, float, int, int, float)
|
average_entry, entry_price, entry_size_asset, entry_size_usd, position_size_asset, position_size_usd, total_possible_loss, total_trades, sl_pct |
short_entry_size_np ¶
short_entry_size_np(sl_price, entry_price, total_possible_loss)
Summary
Formula to calulcate the short entry size when we are not in a position and have our stop loss type set to stop loss based on candle body
how to calculate pnl https://www.bybithelp.com/en-US/s/article/Profit-Loss-calculations-USDT-Contract
Parameters:
Name | Type | Description | Default |
---|---|---|---|
entry_price |
float
|
entry_price |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
Returns:
Type | Description |
---|---|
float
|
entry_size_usd |
short_entry_size_p ¶
short_entry_size_p(average_entry, entry_price, position_size_usd, sl_price, total_possible_loss)
Summary
Formula to calulcate the short entry size when we are in a position and have our stop loss type set to stop loss based on candle body
how to calculate pnl https://www.bybithelp.com/en-US/s/article/Profit-Loss-calculations-USDT-Contract
Parameters:
Name | Type | Description | Default |
---|---|---|---|
average_entry |
float
|
average_entry |
required |
entry_price |
float
|
entry_price |
required |
position_size_usd |
float
|
position_size_usd |
required |
total_possible_loss |
float
|
total_possible_loss |
required |
sl_price |
float
|
sl_price |
required |
Returns:
Type | Description |
---|---|
float
|
entry_size_usd |