diff --git a/configuration/index.html b/configuration/index.html index 9e76d268..7503b882 100644 --- a/configuration/index.html +++ b/configuration/index.html @@ -1030,6 +1030,8 @@

Example Configuration Snippet

"dashboard_enabled": false, "shared_data_path": "data/", "linear_grid": { + "grid_behavior": "infinite", + "drawdown_behavior": "maxqtypercent", "target_coins_mode": false, "auto_graceful_stop": false, "entry_signal_type": "lorentzian", diff --git a/search/search_index.json b/search/search_index.json index f5aa3fa3..25daca8f 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Directional Scalper","text":"

Welcome to the documentation for Directional Scalper.

"},{"location":"#links","title":"Links","text":" Directional Scalper API Scraper Dashboard Directional Scalper Multi Menu GUI

Quantum Void Labs is a non-profit organization dedicated to developing open-source applications. We specialize in developing algorithms that are freely available to the public under the MIT License.

Our focus is on contributing to the global knowledge base rather than commercializing our work.

We do not sell products or services; instead, we aim to encourage innovation and collaboration within the ecosystem through our open-source contributions.

"},{"location":"configuration/","title":"Configuration","text":""},{"location":"configuration/#account-section","title":"Account Section","text":"

Configure your account settings in the account.json file under the account section. This includes API keys, account names, and other related settings.

"},{"location":"configuration/#parameters","title":"Parameters:","text":""},{"location":"configuration/#accounts","title":"Accounts","text":"

Configure your accounts using 'account.json' in the configs folder.

{\n    \"exchanges\": [\n        {\n            \"name\": \"bybit\",\n            \"account_name\": \"account_1\",\n            \"api_key\": \"your_api_key\",\n            \"api_secret\": \"your_api_secret\"\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"api_key\": \"your_api_key\",\n            \"api_secret\": \"your_api_secret\"\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"api_key\": \"your_api_key\",\n            \"api_secret\": \"your_api_secret\"\n        }\n    ]\n}\n
"},{"location":"configuration/#bot-section","title":"Bot Section","text":"

Configure your bot settings in the config.json file under the bot section. This includes strategy parameters, risk management settings, and other related settings.

"},{"location":"configuration/#risk-management-parameters","title":"Risk management parameters","text":""},{"location":"configuration/#risk-management-explanation","title":"Risk Management Explanation","text":"

Risk Management plays a crucial role in trading strategies, as it helps protect the trader's capital and limits potential losses. In the provided code snippet, there are several parameters and calculations related to risk management. Let's dive into each of them and provide examples to clarify their usage.

These risk management parameters and calculations help traders control their exposure to risk, limit potential losses, and manage their positions effectively. By adjusting these parameters based on their risk tolerance and trading strategy, traders can optimize their risk management approach and protect their capital.

"},{"location":"configuration/#linear-grid-strategy-parameters","title":"Linear Grid Strategy Parameters","text":"

Here are the parameters for the linear_grid strategy in your config.json file:

"},{"location":"configuration/#example-configuration-snippet","title":"Example Configuration Snippet","text":"
{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0029,\n        \"max_upnl_profit_pct\": 0.0040,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 50,\n        \"min_qty_threshold\": 0,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"BTCUSDT\", \"ETHUSDT\"],\n        \"whitelist\": [],\n        \"dashboard_enabled\": false,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"target_coins_mode\": false,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 30,\n            \"max_qty_percent_short\": 30,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 0.006,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": true,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 30.0,\n            \"upnl_auto_reduce_threshold_short\": 30.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.07,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n          \"name\": \"bybit\",\n          \"account_name\": \"account_1\",\n          \"symbols_allowed\": 10\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n
"},{"location":"control_center/","title":"Control Center","text":""},{"location":"control_center/#configuring-the-password","title":"Configuring the Password","text":"
  1. Open the config.toml file in the directionalscalper/controlcenter/ directory in a text editor: nano config.toml
  2. Add or update the [credentials] section with your desired password: [credentials] password = \"your_password_here\"
  3. Save the file and close the editor.
"},{"location":"control_center/#starting-the-streamlit-dashboard","title":"Starting the Streamlit Dashboard","text":"

To start the Streamlit dashboard (Control Center) for Directional Scalper, follow these steps:

  1. Navigate to the directionalscalper/controlcenter/ directory: cd directionalscalper/controlcenter/
  2. Ensure you have Streamlit installed. If not, you can install it using: pip install streamlit
  3. Run the dashboard using Streamlit: streamlit run dashboard.py
  4. The dashboard will prompt for a password. You need to configure this password in the config.toml file located in the same directory.
"},{"location":"control_center/#accessing-the-dashboard","title":"Accessing the Dashboard","text":"

Once the dashboard is running, you can access it through your web browser by navigating to the local URL provided by Streamlit (usually http://localhost:8501). Ensure that your firewall or network settings allow access to this port if you are accessing it remotely.

"},{"location":"installation/","title":"Installation","text":""},{"location":"installation/#vps-setup","title":"VPS Setup","text":"

To set up a VPS (Virtual Private Server) for running the bot, follow these steps:

  1. Choose a VPS Provider: Select a VPS provider such as Hetzner, DigitalOcean, AWS, or Linode. For optimal performance, it is recommended to use a Hetzner 4 core 8GB Intel server. Create an account and set up a new VPS instance with at least 4 Cores and 8GB of RAM and a suitable operating system (e.g., Ubuntu 20.04).

  2. Connect to Your VPS: Use SSH to connect to your VPS. Replace your_vps_ip with the IP address of your VPS. ssh root@your_vps_ip

  3. Update and Upgrade Packages: Ensure your VPS is up to date. sudo apt update && sudo apt upgrade -y

  4. Install Python 3.11: Follow the instructions in the \"Installing Python 3.11\" section below to install Python 3.11 on your VPS.

  5. Install Git: If Git is not already installed, install it using: sudo apt install git -y

  6. Clone the Repository: Clone the Directional Scalper repository to your VPS: git clone https://github.com/donewiththedollar/directionalscalper.git

  7. Install Dependencies: Install the required Python dependencies. pip3.11 install -r requirements.txt

  8. Configure the Bot: Rename the configuration files and add your API keys as described in the \"Quickstart\" section.

  9. Run the Bot: Start the bot using the appropriate command as described in the \"Quickstart\" section.

"},{"location":"installation/#prerequisites","title":"Prerequisites","text":"

Before you begin, ensure you have the following prerequisites:

"},{"location":"installation/#quickstart","title":"Quickstart","text":"
  1. Clone the repository: git clone https://github.com/donewiththedollar/directionalscalper.git

    Change current working directory to the project directory: cd directionalscalper

  2. Install the required dependencies: pip3.11 install -r requirements.txt

  3. Rename the config_example.json to config.json located in the /configs folder. Also rename account_example.json to account.json and add your API key(s) to the account.json file located in the /configs folder.

  4. Run the bot:

  5. To display the menu and select a strategy, use the following command: python3.11 multi_bot_aio.py --config configs/config.json or the old method python3.11 multi_bot_v4.py --config config.json (outdated)
  6. Alternatively, you can run the bot with command line parameters:
"},{"location":"installation/#installing-python-311","title":"Installing Python 3.11","text":"

To install Python 3.11 on your system, follow these steps:

  1. Update the package list and install the necessary dependencies: sudo apt update sudo apt install -y build-essential gdb lcov pkg-config \\ libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \\ libncurses5-dev libreadline-dev libsqlite3-dev libssl-dev \\ lzma lzma-dev tk-dev uuid-dev zlib1g-dev

  2. Download the Python 3.11.0 source code: cd /opt wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz

  3. Extract the downloaded archive: sudo tar -xzf Python-3.11.0.tgz

  4. Change to the extracted directory: cd Python-3.11.0

  5. Configure the build with optimizations: sudo ./configure --enable-optimizations --prefix=/usr/local

  6. Compile Python: sudo make -j 8

  7. Install Python 3.11: sudo make altinstall

  8. Verify the installation: python3.11 --version

You should see the installed Python version displayed.

That's it! You have now installed Python 3.11 on your system.

"},{"location":"risk_management/","title":"Risk Management in DirectionalScalper","text":"

This document explains the risk management strategies implemented in the trading bot, focusing on four key parameters from the configuration.

"},{"location":"risk_management/#example-key-configuration-parameters","title":"Example Key Configuration Parameters","text":"
  1. wallet_exposure_limit_long: 0.013 (1.3%)
  2. wallet_exposure_limit_short: 0.004 (0.4%)
  3. max_qty_percent_long: 10%
  4. max_qty_percent_short: 10%
"},{"location":"risk_management/#understanding-the-parameters","title":"Understanding the Parameters","text":""},{"location":"risk_management/#wallet-exposure-limits","title":"Wallet Exposure Limits","text":"

The wallet_exposure_limit_long and wallet_exposure_limit_short parameters define the maximum percentage of the total equity that can be allocated to long and short positions, respectively.

These limits help prevent overexposure to any single trading direction and maintain a balanced risk profile.

"},{"location":"risk_management/#maximum-quantity-percentages","title":"Maximum Quantity Percentages","text":"

The max_qty_percent_long and max_qty_percent_short parameters set the maximum allowed position size as a percentage of the total equity for long and short positions, respectively.

These limits act as an additional safety measure to prevent any single position from becoming too large relative to the total equity.

"},{"location":"risk_management/#risk-management-implementation","title":"Risk Management Implementation","text":"

The bot implements risk management through the check_and_manage_positions function. Here's how it works:

  1. Calculate Maximum Allowed Positions:
  2. For long positions: max_qty_long = (total_equity * wallet_exposure_limit_long) / current_price
  3. For short positions: max_qty_short = (total_equity * wallet_exposure_limit_short) / current_price

  4. Calculate Position Exposure Percentages:

  5. Long exposure: (long_pos_qty * current_price / total_equity) * 100
  6. Short exposure: (short_pos_qty * current_price / total_equity) * 100

  7. Check Against Maximum Quantity Percentages:

  8. If long exposure > max_qty_percent_long:
  9. If short exposure > max_qty_percent_short:

  10. Recovery Mechanism:

  11. If a symbol's exposure falls below the maximum allowed percentage, it is removed from the respective max_qty_reached_symbol set, allowing trading to resume.
"},{"location":"risk_management/#additional-risk-management-features","title":"Additional Risk Management Features","text":""},{"location":"risk_management/#proper-dca-dollar-cost-averaging-implementation","title":"Proper DCA (Dollar Cost Averaging) Implementation","text":"

The bot uses two functions for implementing a proper DCA strategy:

  1. calculate_total_amount_notional_ls_properdca:
  2. Calculates the total notional amount for a grid based on the wallet exposure limits and current position values.
  3. Ensures that the total position value (including existing positions) doesn't exceed the maximum allowed exposure.

  4. calculate_order_amounts_notional_properdca:

  5. Distributes the total notional amount across multiple orders in the grid.
  6. Uses a strength parameter to adjust the distribution, allowing for more aggressive or conservative strategies.
  7. Ensures that each order meets minimum notional and quantity requirements set by the exchange.
"},{"location":"risk_management/#grid-management","title":"Grid Management","text":""},{"location":"risk_management/#conclusion","title":"Conclusion","text":"

This risk management system provides a comprehensive approach to controlling exposure and managing position sizes. By using wallet exposure limits and maximum quantity percentages, the bot maintains a balanced risk profile while allowing for effective trading across multiple symbols and strategies.

The implementation of proper DCA and dynamic grid management further enhances the bot's ability to adapt to market conditions while adhering to predefined risk parameters.

"},{"location":"strategies/","title":"Strategies","text":""},{"location":"strategies/#linear-grid-strategy","title":"Linear Grid Strategy","text":""},{"location":"strategies/#overview","title":"Overview","text":"

The Linear Grid Strategy is a trading strategy designed to capitalize on market fluctuations by placing multiple buy and sell orders at predefined intervals (grid levels) above and below the current price level. This strategy helps in capturing profits in both upward and downward market movements.

"},{"location":"strategies/#configuration-parameters","title":"Configuration Parameters","text":"

Here are the parameters for the linear_grid strategy in your config.json file:

"},{"location":"strategies/#example-configurations","title":"Example Configurations","text":""},{"location":"strategies/#example-long-and-short-auto-rotating-futures-configuration","title":"Example long and short auto rotating futures configuration","text":"

This strategy is based on machine learning based signals and utilizes a grid with proper DCA so each grid level is \"meaningful\" to bring the position to current market price staying \"sticky\" to price action.

Set up your config.json from the below snippet

{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0029,\n        \"max_upnl_profit_pct\": 0.0040,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 50,\n        \"min_qty_threshold\": 0,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"BTCUSDT\", \"ETHUSDT\"],\n        \"whitelist\": [],\n        \"dashboard_enabled\": false,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"target_coins_mode\": false,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 30,\n            \"max_qty_percent_short\": 30,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 0.006,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": true,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 30.0,\n            \"upnl_auto_reduce_threshold_short\": 30.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.07,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n          \"name\": \"bybit\",\n          \"account_name\": \"account_1\",\n          \"symbols_allowed\": 10\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n

Now, just run the bot using this multibot version and strategy

python3.11 multi_bot_aio.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

"},{"location":"strategies/#example-long-only-solusdt-futures-configuration","title":"Example long only SOLUSDT futures configuration","text":"

Set up your config.json from the below snippet to whitelist SOLUSDT and set max USD value to a higher value to allow for the symbol.

max_qty_percent_long and max_qty_pct_short are set high in this configuration, you can adjust them as needed these are just defaults for testing purposes.

{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0032,\n        \"max_upnl_profit_pct\": 0.0039,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 1000,\n        \"min_qty_threshold\": 0,\n        \"long_liq_pct\": 0.05,\n        \"short_liq_pct\": 0.05,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"BTCUSDT\", \"ETHUSDT\"],\n        \"whitelist\": [\"SOLUSDT\"],\n        \"dashboard_enabled\": true,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"target_coins_mode\": true,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 10000,\n            \"max_qty_percent_short\": 10000,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 1,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": false,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 10.0,\n            \"upnl_auto_reduce_threshold_short\": 10.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.05,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n            \"name\": \"bybit\",\n            \"account_name\": \"account_1\",\n            \"symbols_allowed\": 2\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n\n

Now, just run the bot using this multibot version and strategy

python3.11 multi_bot_aio.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

This is just a simple example of a long only BTCUSDT strategy to show how one can utilize a single strategy for many use case scenarios on different instruments.

"},{"location":"strategies/#example-high-risk-small-account-longshort-btcusdt-futures-configuration","title":"Example High risk small account long&short BTCUSDT futures configuration","text":"

Set up your config.json from the below snippet to whitelist BTCUSDT and set max USD value to a high value to allow for the symbol.

max_qty_percent_long and max_qty_pct_short are set high in this configuration, you can adjust them as needed these are just defaults for testing purposes.

{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0032,\n        \"max_upnl_profit_pct\": 0.0039,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 1000,\n        \"min_qty_threshold\": 0,\n        \"long_liq_pct\": 0.05,\n        \"short_liq_pct\": 0.05,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"ETHUSDT\"],\n        \"whitelist\": [\"BTCUSDT\"],\n        \"dashboard_enabled\": true,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"target_coins_mode\": true,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 10000,\n            \"max_qty_percent_short\": 10000,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 1,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": true,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 10.0,\n            \"upnl_auto_reduce_threshold_short\": 10.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.05,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n            \"name\": \"bybit\",\n            \"account_name\": \"account_1\",\n            \"symbols_allowed\": 2\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n\n

Now, just run the bot using this multibot version and strategy

python3.11 multi_bot_signalscreener_targetcoin.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

This is an aggressive approach because it utilizes a high max_qty_percent_long and max_qty_percent_short on a small wallet balance (ie $100 USD) for a symbol with a high USD value with the min notional requirement for BTCUSDT on Bybit it is inherently more risky but also more profitable.

"},{"location":"usage/","title":"Usage","text":"

This guide will help you run the Directional Scalper bot using various command-line instructions. Ensure you have properly configured your config.json and account.json files before proceeding.

"},{"location":"usage/#running-the-bot","title":"Running the Bot","text":""},{"location":"usage/#easy-update-configuration-file-with-latest-parameters","title":"Easy update configuration file with latest parameters","text":"
pip3.11 install -r requirements.txt && python3.11 update_config.py --config configs/config.json && mv configs/config.json.new configs/config.json\n
python3.11 multi_bot_v4.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json\n
"},{"location":"usage/#displaying-the-menu-and-selecting-a-strategy","title":"Displaying the Menu and Selecting a Strategy","text":"

To display the menu and select a strategy, use the following command:

python3.11 multi_bot_v4.py --config configs/config.json\n

or

python3.11 multi_bot_v4.py --config configs/config.json\n
"},{"location":"usage/#running-the-bot-with-command-line-parameters","title":"Running the Bot with Command Line Parameters","text":"

You can also run the bot directly with specific command-line parameters. Below are examples of different strategies you can use:

"},{"location":"usage/#multi-bot-auto-symbol-rotator-strategy","title":"Multi-Bot Auto Symbol Rotator Strategy","text":"

To run the multi-bot auto symbol rotator strategy, use the following command:

python3.11 multi_bot_v4.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json\n
"},{"location":"usage/#old-single-coin-strategy","title":"Old Single Coin Strategy","text":"

To run the old single coin strategy, use the following command: (likely very outdated, but can be updated by anyone or per request)

python3.11 bot.py --exchange bybit --symbol DOGEUSDT --strategy qstrendob --config configs/config.json\n
"},{"location":"usage/#command-line-parameters","title":"Command Line Parameters","text":""},{"location":"usage/#general-parameters","title":"General Parameters","text":""},{"location":"usage/#example-commands","title":"Example Commands","text":"
  1. Running the Multi-Bot Auto Symbol Rotator Strategy for Bybit:

python3.11 multi_bot_v4.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

  1. Running the Old Single Coin Strategy for DOGEUSDT on Bybit:

python3.11 bot.py --exchange bybit --symbol DOGEUSDT --strategy qstrendob --config configs/config.json

"},{"location":"usage/#additional-notes","title":"Additional Notes","text":"

This guide provides a straightforward approach to running the Directional Scalper bot with various strategies and configurations. If you encounter any issues, refer to the relevant sections of the documentation for more details.

"}]} \ No newline at end of file +{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Directional Scalper","text":"

Welcome to the documentation for Directional Scalper.

"},{"location":"#links","title":"Links","text":" Directional Scalper API Scraper Dashboard Directional Scalper Multi Menu GUI

Quantum Void Labs is a non-profit organization dedicated to developing open-source applications. We specialize in developing algorithms that are freely available to the public under the MIT License.

Our focus is on contributing to the global knowledge base rather than commercializing our work.

We do not sell products or services; instead, we aim to encourage innovation and collaboration within the ecosystem through our open-source contributions.

"},{"location":"configuration/","title":"Configuration","text":""},{"location":"configuration/#account-section","title":"Account Section","text":"

Configure your account settings in the account.json file under the account section. This includes API keys, account names, and other related settings.

"},{"location":"configuration/#parameters","title":"Parameters:","text":""},{"location":"configuration/#accounts","title":"Accounts","text":"

Configure your accounts using 'account.json' in the configs folder.

{\n    \"exchanges\": [\n        {\n            \"name\": \"bybit\",\n            \"account_name\": \"account_1\",\n            \"api_key\": \"your_api_key\",\n            \"api_secret\": \"your_api_secret\"\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"api_key\": \"your_api_key\",\n            \"api_secret\": \"your_api_secret\"\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"api_key\": \"your_api_key\",\n            \"api_secret\": \"your_api_secret\"\n        }\n    ]\n}\n
"},{"location":"configuration/#bot-section","title":"Bot Section","text":"

Configure your bot settings in the config.json file under the bot section. This includes strategy parameters, risk management settings, and other related settings.

"},{"location":"configuration/#risk-management-parameters","title":"Risk management parameters","text":""},{"location":"configuration/#risk-management-explanation","title":"Risk Management Explanation","text":"

Risk Management plays a crucial role in trading strategies, as it helps protect the trader's capital and limits potential losses. In the provided code snippet, there are several parameters and calculations related to risk management. Let's dive into each of them and provide examples to clarify their usage.

These risk management parameters and calculations help traders control their exposure to risk, limit potential losses, and manage their positions effectively. By adjusting these parameters based on their risk tolerance and trading strategy, traders can optimize their risk management approach and protect their capital.

"},{"location":"configuration/#linear-grid-strategy-parameters","title":"Linear Grid Strategy Parameters","text":"

Here are the parameters for the linear_grid strategy in your config.json file:

"},{"location":"configuration/#example-configuration-snippet","title":"Example Configuration Snippet","text":"
{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0029,\n        \"max_upnl_profit_pct\": 0.0040,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 50,\n        \"min_qty_threshold\": 0,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"BTCUSDT\", \"ETHUSDT\"],\n        \"whitelist\": [],\n        \"dashboard_enabled\": false,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"grid_behavior\": \"infinite\",\n            \"drawdown_behavior\": \"maxqtypercent\",\n            \"target_coins_mode\": false,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 30,\n            \"max_qty_percent_short\": 30,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 0.006,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": true,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 30.0,\n            \"upnl_auto_reduce_threshold_short\": 30.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.07,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n          \"name\": \"bybit\",\n          \"account_name\": \"account_1\",\n          \"symbols_allowed\": 10\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n
"},{"location":"control_center/","title":"Control Center","text":""},{"location":"control_center/#configuring-the-password","title":"Configuring the Password","text":"
  1. Open the config.toml file in the directionalscalper/controlcenter/ directory in a text editor: nano config.toml
  2. Add or update the [credentials] section with your desired password: [credentials] password = \"your_password_here\"
  3. Save the file and close the editor.
"},{"location":"control_center/#starting-the-streamlit-dashboard","title":"Starting the Streamlit Dashboard","text":"

To start the Streamlit dashboard (Control Center) for Directional Scalper, follow these steps:

  1. Navigate to the directionalscalper/controlcenter/ directory: cd directionalscalper/controlcenter/
  2. Ensure you have Streamlit installed. If not, you can install it using: pip install streamlit
  3. Run the dashboard using Streamlit: streamlit run dashboard.py
  4. The dashboard will prompt for a password. You need to configure this password in the config.toml file located in the same directory.
"},{"location":"control_center/#accessing-the-dashboard","title":"Accessing the Dashboard","text":"

Once the dashboard is running, you can access it through your web browser by navigating to the local URL provided by Streamlit (usually http://localhost:8501). Ensure that your firewall or network settings allow access to this port if you are accessing it remotely.

"},{"location":"installation/","title":"Installation","text":""},{"location":"installation/#vps-setup","title":"VPS Setup","text":"

To set up a VPS (Virtual Private Server) for running the bot, follow these steps:

  1. Choose a VPS Provider: Select a VPS provider such as Hetzner, DigitalOcean, AWS, or Linode. For optimal performance, it is recommended to use a Hetzner 4 core 8GB Intel server. Create an account and set up a new VPS instance with at least 4 Cores and 8GB of RAM and a suitable operating system (e.g., Ubuntu 20.04).

  2. Connect to Your VPS: Use SSH to connect to your VPS. Replace your_vps_ip with the IP address of your VPS. ssh root@your_vps_ip

  3. Update and Upgrade Packages: Ensure your VPS is up to date. sudo apt update && sudo apt upgrade -y

  4. Install Python 3.11: Follow the instructions in the \"Installing Python 3.11\" section below to install Python 3.11 on your VPS.

  5. Install Git: If Git is not already installed, install it using: sudo apt install git -y

  6. Clone the Repository: Clone the Directional Scalper repository to your VPS: git clone https://github.com/donewiththedollar/directionalscalper.git

  7. Install Dependencies: Install the required Python dependencies. pip3.11 install -r requirements.txt

  8. Configure the Bot: Rename the configuration files and add your API keys as described in the \"Quickstart\" section.

  9. Run the Bot: Start the bot using the appropriate command as described in the \"Quickstart\" section.

"},{"location":"installation/#prerequisites","title":"Prerequisites","text":"

Before you begin, ensure you have the following prerequisites:

"},{"location":"installation/#quickstart","title":"Quickstart","text":"
  1. Clone the repository: git clone https://github.com/donewiththedollar/directionalscalper.git

    Change current working directory to the project directory: cd directionalscalper

  2. Install the required dependencies: pip3.11 install -r requirements.txt

  3. Rename the config_example.json to config.json located in the /configs folder. Also rename account_example.json to account.json and add your API key(s) to the account.json file located in the /configs folder.

  4. Run the bot:

  5. To display the menu and select a strategy, use the following command: python3.11 multi_bot_aio.py --config configs/config.json or the old method python3.11 multi_bot_v4.py --config config.json (outdated)
  6. Alternatively, you can run the bot with command line parameters:
"},{"location":"installation/#installing-python-311","title":"Installing Python 3.11","text":"

To install Python 3.11 on your system, follow these steps:

  1. Update the package list and install the necessary dependencies: sudo apt update sudo apt install -y build-essential gdb lcov pkg-config \\ libbz2-dev libffi-dev libgdbm-dev libgdbm-compat-dev liblzma-dev \\ libncurses5-dev libreadline-dev libsqlite3-dev libssl-dev \\ lzma lzma-dev tk-dev uuid-dev zlib1g-dev

  2. Download the Python 3.11.0 source code: cd /opt wget https://www.python.org/ftp/python/3.11.0/Python-3.11.0.tgz

  3. Extract the downloaded archive: sudo tar -xzf Python-3.11.0.tgz

  4. Change to the extracted directory: cd Python-3.11.0

  5. Configure the build with optimizations: sudo ./configure --enable-optimizations --prefix=/usr/local

  6. Compile Python: sudo make -j 8

  7. Install Python 3.11: sudo make altinstall

  8. Verify the installation: python3.11 --version

You should see the installed Python version displayed.

That's it! You have now installed Python 3.11 on your system.

"},{"location":"risk_management/","title":"Risk Management in DirectionalScalper","text":"

This document explains the risk management strategies implemented in the trading bot, focusing on four key parameters from the configuration.

"},{"location":"risk_management/#example-key-configuration-parameters","title":"Example Key Configuration Parameters","text":"
  1. wallet_exposure_limit_long: 0.013 (1.3%)
  2. wallet_exposure_limit_short: 0.004 (0.4%)
  3. max_qty_percent_long: 10%
  4. max_qty_percent_short: 10%
"},{"location":"risk_management/#understanding-the-parameters","title":"Understanding the Parameters","text":""},{"location":"risk_management/#wallet-exposure-limits","title":"Wallet Exposure Limits","text":"

The wallet_exposure_limit_long and wallet_exposure_limit_short parameters define the maximum percentage of the total equity that can be allocated to long and short positions, respectively.

These limits help prevent overexposure to any single trading direction and maintain a balanced risk profile.

"},{"location":"risk_management/#maximum-quantity-percentages","title":"Maximum Quantity Percentages","text":"

The max_qty_percent_long and max_qty_percent_short parameters set the maximum allowed position size as a percentage of the total equity for long and short positions, respectively.

These limits act as an additional safety measure to prevent any single position from becoming too large relative to the total equity.

"},{"location":"risk_management/#risk-management-implementation","title":"Risk Management Implementation","text":"

The bot implements risk management through the check_and_manage_positions function. Here's how it works:

  1. Calculate Maximum Allowed Positions:
  2. For long positions: max_qty_long = (total_equity * wallet_exposure_limit_long) / current_price
  3. For short positions: max_qty_short = (total_equity * wallet_exposure_limit_short) / current_price

  4. Calculate Position Exposure Percentages:

  5. Long exposure: (long_pos_qty * current_price / total_equity) * 100
  6. Short exposure: (short_pos_qty * current_price / total_equity) * 100

  7. Check Against Maximum Quantity Percentages:

  8. If long exposure > max_qty_percent_long:
  9. If short exposure > max_qty_percent_short:

  10. Recovery Mechanism:

  11. If a symbol's exposure falls below the maximum allowed percentage, it is removed from the respective max_qty_reached_symbol set, allowing trading to resume.
"},{"location":"risk_management/#additional-risk-management-features","title":"Additional Risk Management Features","text":""},{"location":"risk_management/#proper-dca-dollar-cost-averaging-implementation","title":"Proper DCA (Dollar Cost Averaging) Implementation","text":"

The bot uses two functions for implementing a proper DCA strategy:

  1. calculate_total_amount_notional_ls_properdca:
  2. Calculates the total notional amount for a grid based on the wallet exposure limits and current position values.
  3. Ensures that the total position value (including existing positions) doesn't exceed the maximum allowed exposure.

  4. calculate_order_amounts_notional_properdca:

  5. Distributes the total notional amount across multiple orders in the grid.
  6. Uses a strength parameter to adjust the distribution, allowing for more aggressive or conservative strategies.
  7. Ensures that each order meets minimum notional and quantity requirements set by the exchange.
"},{"location":"risk_management/#grid-management","title":"Grid Management","text":""},{"location":"risk_management/#conclusion","title":"Conclusion","text":"

This risk management system provides a comprehensive approach to controlling exposure and managing position sizes. By using wallet exposure limits and maximum quantity percentages, the bot maintains a balanced risk profile while allowing for effective trading across multiple symbols and strategies.

The implementation of proper DCA and dynamic grid management further enhances the bot's ability to adapt to market conditions while adhering to predefined risk parameters.

"},{"location":"strategies/","title":"Strategies","text":""},{"location":"strategies/#linear-grid-strategy","title":"Linear Grid Strategy","text":""},{"location":"strategies/#overview","title":"Overview","text":"

The Linear Grid Strategy is a trading strategy designed to capitalize on market fluctuations by placing multiple buy and sell orders at predefined intervals (grid levels) above and below the current price level. This strategy helps in capturing profits in both upward and downward market movements.

"},{"location":"strategies/#configuration-parameters","title":"Configuration Parameters","text":"

Here are the parameters for the linear_grid strategy in your config.json file:

"},{"location":"strategies/#example-configurations","title":"Example Configurations","text":""},{"location":"strategies/#example-long-and-short-auto-rotating-futures-configuration","title":"Example long and short auto rotating futures configuration","text":"

This strategy is based on machine learning based signals and utilizes a grid with proper DCA so each grid level is \"meaningful\" to bring the position to current market price staying \"sticky\" to price action.

Set up your config.json from the below snippet

{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0029,\n        \"max_upnl_profit_pct\": 0.0040,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 50,\n        \"min_qty_threshold\": 0,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"BTCUSDT\", \"ETHUSDT\"],\n        \"whitelist\": [],\n        \"dashboard_enabled\": false,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"grid_behavior\": \"infinite\",\n            \"drawdown_behavior\": \"maxqtypercent\",\n            \"target_coins_mode\": false,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 30,\n            \"max_qty_percent_short\": 30,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 0.006,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": true,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 30.0,\n            \"upnl_auto_reduce_threshold_short\": 30.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.07,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n          \"name\": \"bybit\",\n          \"account_name\": \"account_1\",\n          \"symbols_allowed\": 10\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n

Now, just run the bot using this multibot version and strategy

python3.11 multi_bot_aio.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

"},{"location":"strategies/#example-long-only-solusdt-futures-configuration","title":"Example long only SOLUSDT futures configuration","text":"

Set up your config.json from the below snippet to whitelist SOLUSDT and set max USD value to a higher value to allow for the symbol.

max_qty_percent_long and max_qty_pct_short are set high in this configuration, you can adjust them as needed these are just defaults for testing purposes.

{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0032,\n        \"max_upnl_profit_pct\": 0.0039,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 1000,\n        \"min_qty_threshold\": 0,\n        \"long_liq_pct\": 0.05,\n        \"short_liq_pct\": 0.05,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"BTCUSDT\", \"ETHUSDT\"],\n        \"whitelist\": [\"SOLUSDT\"],\n        \"dashboard_enabled\": true,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"grid_behavior\": \"infinite\",\n            \"drawdown_behavior\": \"maxqtypercent\",\n            \"target_coins_mode\": true,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 10000,\n            \"max_qty_percent_short\": 10000,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 1,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": false,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 10.0,\n            \"upnl_auto_reduce_threshold_short\": 10.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.05,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n            \"name\": \"bybit\",\n            \"account_name\": \"account_1\",\n            \"symbols_allowed\": 2\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n\n

Now, just run the bot using this multibot version and strategy

python3.11 multi_bot_aio.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

This is just a simple example of a long only BTCUSDT strategy to show how one can utilize a single strategy for many use case scenarios on different instruments.

"},{"location":"strategies/#example-high-risk-small-account-longshort-btcusdt-futures-configuration","title":"Example High risk small account long&short BTCUSDT futures configuration","text":"

Set up your config.json from the below snippet to whitelist BTCUSDT and set max USD value to a high value to allow for the symbol.

max_qty_percent_long and max_qty_pct_short are set high in this configuration, you can adjust them as needed these are just defaults for testing purposes.

{\n    \"api\": {\n        \"filename\": \"quantdatav2_bybit.json\",\n        \"mode\": \"remote\",\n        \"url\": \"https://api.quantumvoid.org/volumedata/\",\n        \"data_source_exchange\": \"bybit\"\n    },\n    \"bot\": {\n        \"bot_name\": \"your_bot_name\",\n        \"volume_check\": false,\n        \"min_distance\": 0.15,\n        \"min_volume\": 10000,\n        \"upnl_profit_pct\": 0.0032,\n        \"max_upnl_profit_pct\": 0.0039,\n        \"auto_reduce_enabled\": false,\n        \"auto_reduce_start_pct\": 0.068,\n        \"entry_during_autoreduce\": false,\n        \"stoploss_enabled\": false,\n        \"stoploss_upnl_pct\": 0.05,\n        \"liq_stoploss_enabled\": false,\n        \"liq_price_stop_pct\": 0.50,\n        \"percentile_auto_reduce_enabled\": false,\n        \"upnl_threshold_pct\": 0.50,\n        \"max_pos_balance_pct\": 0.50,\n        \"auto_reduce_wallet_exposure_pct\": 0.20,\n        \"auto_reduce_maxloss_pct\": 0.30,\n        \"auto_reduce_marginbased_enabled\": false,\n        \"hedge_ratio\": 0.10,\n        \"hedge_price_difference_threshold\": 0.10,\n        \"test_orders_enabled\": false,\n        \"max_usd_value\": 1000,\n        \"min_qty_threshold\": 0,\n        \"long_liq_pct\": 0.05,\n        \"short_liq_pct\": 0.05,\n        \"MaxAbsFundingRate\": 0.0002,\n        \"blacklist\": [\"ETHUSDT\"],\n        \"whitelist\": [\"BTCUSDT\"],\n        \"dashboard_enabled\": true,\n        \"shared_data_path\": \"data/\",\n        \"linear_grid\": {\n            \"grid_behavior\": \"infinite\",\n            \"drawdown_behavior\": \"maxqtypercent\",\n            \"target_coins_mode\": true,\n            \"auto_graceful_stop\": false,\n            \"entry_signal_type\": \"lorentzian\",\n            \"additional_entries_from_signal\": true,\n            \"graceful_stop_long\": false,\n            \"graceful_stop_short\": false,\n            \"max_qty_percent_long\": 10000,\n            \"max_qty_percent_short\": 10000,\n            \"auto_reduce_cooldown_enabled\": false,\n            \"auto_reduce_cooldown_start_pct\": 0.051,\n            \"wallet_exposure_limit_long\": 1,\n            \"wallet_exposure_limit_short\": 0.002,\n            \"levels\": 4,\n            \"strength\": 1.4,\n            \"outer_price_distance\": 0.059,\n            \"min_outer_price_distance\": 0.019,\n            \"max_outer_price_distance\": 0.049,\n            \"long_mode\": true,\n            \"short_mode\": true,\n            \"reissue_threshold\": 0.001,\n            \"buffer_percentage\": 0.10,\n            \"initial_entry_buffer_pct\": 0.0001,\n            \"min_buffer_percentage\": 0.0035,\n            \"max_buffer_percentage\": 0.010,\n            \"enforce_full_grid\": true,\n            \"min_buffer_percentage_ar\": 0.002,\n            \"max_buffer_percentage_ar\": 0.004,\n            \"upnl_auto_reduce_threshold_long\": 10.0,\n            \"upnl_auto_reduce_threshold_short\": 10.0,\n            \"failsafe_enabled\": false,\n            \"failsafe_start_pct\": 0.05,\n            \"long_failsafe_upnl_pct\": 10.0,\n            \"short_failsafe_upnl_pct\": 10.0\n        },\n        \"hotkeys\": {\n            \"hotkeys_enabled\": false,\n            \"enter_long\": \"1\",\n            \"take_profit_long\": \"2\",\n            \"enter_short\": \"3\",\n            \"take_profit_short\": \"4\"\n        }\n    },\n    \"exchanges\": [\n        {\n            \"name\": \"bybit\",\n            \"account_name\": \"account_1\",\n            \"symbols_allowed\": 2\n        },\n        {\n            \"name\": \"bybit_spot\",\n            \"account_name\": \"account_2\",\n            \"symbols_allowed\": 5\n        },\n        {\n            \"name\": \"bybit_unified\",\n            \"account_name\": \"account_3\",\n            \"symbols_allowed\": 5\n        }\n    ],\n    \"logger\": {\n        \"level\": \"info\"\n    },\n    \"messengers\": {\n        \"discord\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"discord\",\n            \"webhook_url\": \"https://discord.com/api/webhooks/your_webhook_id/your_webhook_token\"\n        },\n        \"telegram\": {\n            \"active\": false,\n            \"embedded_messages\": true,\n            \"messenger_type\": \"telegram\",\n            \"bot_token\": \"your_bot_token\",\n            \"chat_id\": \"your_chat_id\"\n        }\n    }\n  }\n\n

Now, just run the bot using this multibot version and strategy

python3.11 multi_bot_signalscreener_targetcoin.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

This is an aggressive approach because it utilizes a high max_qty_percent_long and max_qty_percent_short on a small wallet balance (ie $100 USD) for a symbol with a high USD value with the min notional requirement for BTCUSDT on Bybit it is inherently more risky but also more profitable.

"},{"location":"usage/","title":"Usage","text":"

This guide will help you run the Directional Scalper bot using various command-line instructions. Ensure you have properly configured your config.json and account.json files before proceeding.

"},{"location":"usage/#running-the-bot","title":"Running the Bot","text":""},{"location":"usage/#easy-update-configuration-file-with-latest-parameters","title":"Easy update configuration file with latest parameters","text":"
pip3.11 install -r requirements.txt && python3.11 update_config.py --config configs/config.json && mv configs/config.json.new configs/config.json\n
python3.11 multi_bot_v4.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json\n
"},{"location":"usage/#displaying-the-menu-and-selecting-a-strategy","title":"Displaying the Menu and Selecting a Strategy","text":"

To display the menu and select a strategy, use the following command:

python3.11 multi_bot_v4.py --config configs/config.json\n

or

python3.11 multi_bot_v4.py --config configs/config.json\n
"},{"location":"usage/#running-the-bot-with-command-line-parameters","title":"Running the Bot with Command Line Parameters","text":"

You can also run the bot directly with specific command-line parameters. Below are examples of different strategies you can use:

"},{"location":"usage/#multi-bot-auto-symbol-rotator-strategy","title":"Multi-Bot Auto Symbol Rotator Strategy","text":"

To run the multi-bot auto symbol rotator strategy, use the following command:

python3.11 multi_bot_v4.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json\n
"},{"location":"usage/#old-single-coin-strategy","title":"Old Single Coin Strategy","text":"

To run the old single coin strategy, use the following command: (likely very outdated, but can be updated by anyone or per request)

python3.11 bot.py --exchange bybit --symbol DOGEUSDT --strategy qstrendob --config configs/config.json\n
"},{"location":"usage/#command-line-parameters","title":"Command Line Parameters","text":""},{"location":"usage/#general-parameters","title":"General Parameters","text":""},{"location":"usage/#example-commands","title":"Example Commands","text":"
  1. Running the Multi-Bot Auto Symbol Rotator Strategy for Bybit:

python3.11 multi_bot_v4.py --exchange bybit --account_name account_1 --strategy qsgridob --config configs/config.json

  1. Running the Old Single Coin Strategy for DOGEUSDT on Bybit:

python3.11 bot.py --exchange bybit --symbol DOGEUSDT --strategy qstrendob --config configs/config.json

"},{"location":"usage/#additional-notes","title":"Additional Notes","text":"

This guide provides a straightforward approach to running the Directional Scalper bot with various strategies and configurations. If you encounter any issues, refer to the relevant sections of the documentation for more details.

"}]} \ No newline at end of file diff --git a/sitemap.xml.gz b/sitemap.xml.gz index 8ea9fb7c..253397b2 100644 Binary files a/sitemap.xml.gz and b/sitemap.xml.gz differ diff --git a/strategies/index.html b/strategies/index.html index 407d5712..c7cc2db9 100644 --- a/strategies/index.html +++ b/strategies/index.html @@ -909,6 +909,8 @@

Example long "dashboard_enabled": false, "shared_data_path": "data/", "linear_grid": { + "grid_behavior": "infinite", + "drawdown_behavior": "maxqtypercent", "target_coins_mode": false, "auto_graceful_stop": false, "entry_signal_type": "lorentzian", @@ -1033,6 +1035,8 @@

Example long only SOLUS "dashboard_enabled": true, "shared_data_path": "data/", "linear_grid": { + "grid_behavior": "infinite", + "drawdown_behavior": "maxqtypercent", "target_coins_mode": true, "auto_graceful_stop": false, "entry_signal_type": "lorentzian", @@ -1159,6 +1163,8 @@