Skip to content

Commit

Permalink
Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
bmino committed Oct 23, 2020
1 parent 81dfa16 commit bf699de
Show file tree
Hide file tree
Showing 4 changed files with 71 additions and 13 deletions.
1 change: 1 addition & 0 deletions config/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ Upon each version update you should copy the new syntax from `config.json.exampl
* Description: Delay (ms) between completing calculations and starting another cycle
* Special Values:
* `0` - Executes calculation cycles as soon as new depth information is received
* [Extended Documentation](../src/resources/docs/scanning.md)

#### `SCANNING.DEPTH` (Number)
* Default: `20`
Expand Down
30 changes: 20 additions & 10 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ arbitrage opportunities. To disable the HUD, set `HUD.ENABLED` to false.

### Reading the HUD
* **Trade** - Three symbols related by exchange rates that are involved in the triangle arbitrage.
* **Profit** - Percent profit or loss from executing the triangle arbitrage. This includes trading fees specified via `TRADING.TAKER_FEE` config.
* **Profit** - Percent profit or loss from executing the triangle arbitrage. This includes trading fees specified via `EXECUTION.FEE` config.
* **AB Age** - Time in seconds since the most recent update of the market ticker relating the first and second symbols in the arbitrage.
* **BC Age** - Time in seconds since the most recent update of the market ticker relating the second and third symbols in the arbitrage.
* **CA Age** - Time in seconds since the most recent update of the market ticker relating the third and first symbols in the arbitrage.
Expand All @@ -27,8 +27,8 @@ These instructions will get a copy of the project up and running on your local m
### Install Prerequisites
The following dependencies are recommended to run an instance:

1. **NodeJS** - 11.10.0
2. **Npm** - 6.10.0
1. **NodeJS** - 12.19.0
2. **Npm** - 6.14.8


### Obtain the Codebase
Expand All @@ -40,7 +40,7 @@ The following dependencies are recommended to run an instance:


### Configuration
All configuration is done inside the `/config` directory.
All configuration is managed inside the `/config` directory.
To setup your configuration for the first time, duplicate the `config.json.example` file and remove the ".example" extension.
This process must be done before deploying the app for the first time and redone after each major version update where the configuration has changed.
Explanations of each value can be found [here](config/readme.md).
Expand All @@ -62,18 +62,28 @@ Explanations of each value can be found [here](config/readme.md).
```


## Execution strategies
There are two supported methods of executing an identified triangle arbitrage opportunity. More details [here](src/resources/docs/strategies.md)
## Scanning Strategies
There are two methods of analyzing order book data to identify potential arbitrage opportunities.
More details [here](src/resources/docs/scanning.md)

* **Linear** - Three trades are executed sequentially with each being initiated after the previous has completed
* **Parallel** - Three trades are executed asynchronously with each being initiated at the same time
* **Callback** - Perform analysis on tickers immediately upon receiving a depth cache update
* **Scheduled** - Perform analysis of all tickers iteratively with a predetermined delay between each cycle


## Execution Strategies
There are two supported methods of executing an identified triangle arbitrage opportunity.
More details [here](src/resources/docs/strategies.md)

* **Linear** - Execute three trades sequentially with each being initiated after the previous has completed
* **Parallel** - Execute three trades asynchronously with each being initiated at the same time


## Logging
All logs are stored in the `/logs` directory. The log level is set via the `LOG.LEVEL` configuration property.

* **performance.log** - Data about performance and speed
* **execution.log** - Market interactions and profits
* **binance.log** - Binance api logging


## Authors
Expand All @@ -87,8 +97,8 @@ The developers listed above created and currently maintain this project for free
I don't expect any compensation nor donations, but if you appreciate my work feel free to donate to the following addresses:

* Bitcoin (BTC): 1KLBb9qzFN19RxaQwD35CQmnYZvW1819XZ
* Binance Coin (BNB): 0xb046b6991eb1bdc838cae567cff838b542e9f19d

* Binance Coin (BEP20): 0xb046b6991eb1bdc838cae567cff838b542e9f19d
* USDT (ERC20): 0xb046b6991eb1bdc838cae567cff838b542e9f19d

## License
This project is licensed under mit
Expand Down
6 changes: 3 additions & 3 deletions src/resources/docs/depths.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# Depth Sizes

Internally the app maintains a copy of the order book. This order book's bid and ask depth is configured via `SCANNING.DEPTH`.
Internally the app maintains a synced copy of the order book. This order book's bid and ask depth is configured via `SCANNING.DEPTH`.


### How Local Order Book is Maintained
### How Local Order Book is Initialized

Websocket connections keep the local order book up to date, but when the app starts up, the order book for each tracked symbol must be initialized.
This is accomplished by requesting a snapshot of the order book from Binance via a REST call.
Expand All @@ -20,7 +20,7 @@ This is because higher depth values have a higher weight assigned by Binance.

**Q**. What happens if I use a `SCANNING.DEPTH` value other than those listed above?

**A**. An order book REST request will be made with the lowest depth value that will satisfy your provided `SCANNING.DEPTH` value
**A**. The local order book will be initialized with the lowest value above that will satisfy your provided `SCANNING.DEPTH` value

---

Expand Down
47 changes: 47 additions & 0 deletions src/resources/docs/scanning.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# Scanning Methods
The two methods of scanning are referred to as "callback scanning" and "scheduled scanning."
Prior to v6.0.0 all scanning used the scheduled scanning method.
The `SCANNING.TIMEOUT` configuration value determines which method is used.
A value of `0` will utilize callback scanning and other values will utilize the legacy scheduled scanning.


### Callback Scanning

Triggers calculation cycles for all related positions each time an order book update is received

##### Pros

* Rapid identification of arbitrage opportunities
* Efficiently perform analysis cycle when new data is available

##### Cons

* More demanding cpu requirements


### Scheduled Scanning

Triggers calculation cycles for all tickers with a delay between each time this is scheduled

##### Pros

* Can throttle analysis cycles when using a weaker cpu
* Cannot be overwhelmed by concurrent analysis cycles

##### Cons

* Slower to identify arbitrage opportunities
* Inefficient analysis cycles on the same data


---


The two scanning methods represent a series of tradeoffs:

| | Callback Scanning | Scheduled Scanning |
|----:|:-----------------:|:------------------:|
| Quickly identify opportunities | X | |
| Efficient analysis cycles | X | |
| Low CPU requirements | | X |
| Can be throttled | | X |

0 comments on commit bf699de

Please sign in to comment.