The request-latency
script is designed to optimize the performance of the Balancer trading platform by identifying the geographically closest deployment region to the exchange. It accomplishes this by:
-
Measuring Network Latency: the script sends automated HTTP requests to the exchange platform and records the round-trip time for each request.
-
Comparative Analysis: it aggregates and compares the latency data from multiple regions to determine which one offers the fastest response times.
-
Optimized Deployment: by identifying the region with the lowest latency, the script enables administrators to deploy services in the region that minimizes delay, thereby enhancing trading efficiency and reducing order execution time.
This script is an essential tool for ensuring that your automated Bitcoin trading on Balancer is as responsive and efficient as possible.
Region | Public Req. Mean | Private Req. Mean |
---|---|---|
New York | N/A | N/A |
San Francisco | N/A | N/A |
Amsterdan | 1.82s | 0.23s |
Singapore | 0.28s | 0.08s |
London | 0.99s | 0.26s |
Frankfurt | 1.02s | 0.24s |
Toronto | 0.61s | 0.16s |
Bangalore | 0.43s | 0.19s |
Sydney | 0.64s | 0.11s |
Region | Public Req. Mean | Private Req. Mean |
---|---|---|
New York | 0.00s | 0.00s |
San Francisco | 0.00s | 0.00s |
Amsterdan | 0.00s | 0.00s |
Singapore | 0.00s | 0.00s |
London | 0.00s | 0.00s |
Frankfurt | 0.00s | 0.00s |
Toronto | 0.00s | 0.00s |
Bangalore | 0.00s | 0.00s |
Sydney | 0.00s | 0.00s |
Region | Public Req. Mean | Private Req. Mean |
---|---|---|
New York | 0.00s | 0.00s |
San Francisco | 0.00s | 0.00s |
Amsterdan | 0.00s | 0.00s |
Singapore | 0.00s | 0.00s |
London | 0.00s | 0.00s |
Frankfurt | 0.00s | 0.00s |
Toronto | 0.00s | 0.00s |
Bangalore | 0.00s | 0.00s |
Sydney | 0.00s | 0.00s |
-
Download the
python3-venv
package:sudo apt install python3.12-venv
-
Download the script:
git clone https://github.com/bitcoin-balancer/request-latency.git
-
Navigate to the script's directory:
cd request-latency
-
Create and activate the virtual environment:
python3 -m venv .venv && source .venv/bin/activate
-
Ensure the virtual environment has been created and that you're making use of its binaries:
which python3 # /home/.../balancer/request-latency/.venv/bin/python3
-
Install the dependencies with pip:
pip3 install -r requirements.txt
-
Execute it by running:
python3 src/index.py
-
Once the script has been started, it will ask you to pick an exchange and to input the API Key and the API Secret before running the tests.