Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/1.0.0/historical draw #3

Merged
merged 8 commits into from
Sep 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,5 @@ cython_debug/
# option (not recommended) you can uncomment the following to ignore the entire idea folder.
#.idea/

liqmap/*.csv
liqmap/*.csv
liqmap/*.png
56 changes: 55 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,58 @@
[![Format code](https://github.com/aoki-h-jp/py-liquidation-map/actions/workflows/Formatter.yml/badge.svg)](https://github.com/aoki-h-jp/py-liquidation-map/actions/workflows/Formatter.yml)

# py-liquidation-map
Visualize Liquidation Map from actual execution data.
Visualize Liquidation Map from actual execution data. Supports for all historical data from binance and bybit. Receiving orders in real-time via websocket and drawing liquidation maps is being implemented.

## Installation

```bash
pip install git+https://github.com/aoki-h-jp/py-liquidation-map
```

## Usage
### Visualize liquidation map from historical data
Download binance BTCUSDT data from start_datetime to end_datetime and draw a liquidation map calculated from orders above threshold=100000 [USDT].
```python
from liqmap.mapping import HistoricalMapping

mapping = HistoricalMapping(
start_datetime='2023-08-01 00:00:00',
end_datetime='2023-08-01 06:00:00',
symbol='BTCUSDT',
exchange='binance',
)

mapping.liquidation_map_from_historical(
mode="gross_value",
threshold_gross_value=100000
)
```
### Output
![image](img/BTCUSDT_2023-08-01_00-00-00-2023-08-01_06-00-00_gross_value_100000.png)
### Visualize liquidation map depth
```python
from liqmap.mapping import HistoricalMapping

mapping = HistoricalMapping(
start_datetime='2023-08-01 00:00:00',
end_datetime='2023-08-01 06:00:00',
symbol='BTCUSDT',
exchange='binance',
)

mapping.liquidation_map_depth_from_historical(
mode="gross_value",
threshold_gross_value=100000
)
```

### Output
![image](img/BTCUSDT_2023-08-01_00-00-00-2023-08-01_06-00-00_gross_value_100000_depth.png)

## If you want to report a bug or request a feature
Please create an issue on this repository!

## Disclaimer
This project is for educational purposes only. You should not construe any such information or other material as legal, tax, investment, financial, or other advice. Nothing contained here constitutes a solicitation, recommendation, endorsement, or offer by me or any third party service provider to buy or sell any securities or other financial instruments in this or in any other jurisdiction in which such solicitation or offer would be unlawful under the securities laws of such jurisdiction.

Under no circumstances will I be held responsible or liable in any way for any claims, damages, losses, expenses, costs, or liabilities whatsoever, including, without limitation, any direct or indirect damages for loss of profits.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion liqmap/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
"""
py-liquidation-map
"""
from liqmap import download, draw
from liqmap import download, mapping
Empty file removed liqmap/draw.py
Empty file.
11 changes: 11 additions & 0 deletions liqmap/exceptions.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
"""
Exceptions for liqmap
"""


class ExchangeNotSupportedError(Exception):
"""
Exception raised when exchange is not supported
"""

pass
Loading