documentation

Signed-off-by: microwavedcola1 <microwavedcola@gmail.com>
This commit is contained in:
microwavedcola1 2021-09-23 09:44:57 +02:00
parent 41e669dd02
commit 6cd2f02f61
7 changed files with 3327 additions and 44 deletions

1
.gitignore vendored
View File

@ -1,6 +1,7 @@
mango-service-v3/node_modules
mango-service-v3/run-docker.sh
mango-service-v3/run-local.sh
mango-service-v3/run-generate-openapi-spec.sh
py/.venv
py/.idea
py/mango_service_v3_py/__pycache__/

View File

@ -1,6 +1,5 @@
# mango-v3-service
REST API Service for mango markets version 3, and some simple clients and examples
# Introduction
REST API Service for mango markets version 3, and some simple clients and examples. Aimed to follow spec as close as possible to popular exchanges like ftx, etc. Motivation is that the experienced traders can bring their existing tools to mango markets. Service requires user to run a local copy with his/her own private key. See postman export to see what is already implemented.
Directory structure
```
@ -9,3 +8,28 @@ Directory structure
├── mango-service-v3 - REST API Service for mango markets version 3
└── py - python3 client for above REST API Service
```
# Contributing
See Todos
# Todos
## Small
- cache various mango related things which change infrequently like e.g. spot+perp markets, placed orders for user, etc.
- combine instructions e.g. cancel+place-> modify, cancel many
- order types e.g. stop loss, market orders
- missing endpoints
- funding rates?
- maker taker fees
- populate still undefined fields in various endpoints
- identify which endpoints are still slow
- todos sprinkled over code
- when null vs when undefined as return field value,- doublecheck for every endpoint/dto
- how often to load/reload certain mango things e.g. account, cache, rootbanks, etc.?
- cleanup tsconfig.json
- add pre commit tools e.g. husky/pre-commit for code formatting and linting
## Large
- integration with freqtrade and/or ccxt https://github.com/ccxt/ccxt/blob/master/js/ftx.js
- integration with tradingview or https://github.com/thibaultyou/tradingview-alerts-processor/blob/master/docs/2_Alerts.md & https://www.tradingview.com/support/solutions/43000529348-about-webhooks/
## Community feedback
- requests https://twitter.com/microwavedcola1/status/1438439176194727937

View File

@ -1,41 +1,18 @@
# mango-v3-service
A REST API server, aimed to follow spec as close as possible to popular exchanges like ftx, etc. Motivation is that experienced traders can bring their existing tools to mango markets. Requires user to run a local copy with his/her own private key. See postman export to see what is already implemented.
# Contributing
Wip
# Pre-requisites
* expects your private key to be present in `~/.config/solana/id.json`
A REST API server on top of mango markets v3, written in typescript + expressjs + using mango client and some other off chain REST services.
# How to run while developing
* expects your private key to be present in `~/.config/solana/id.json`
* `yarn install`
* `PORT=3000 GROUP=mainnet.1 CLUSTER_URL=https://api.mainnet-beta.solana.com nodemon ./src/server.ts`, you probably want to choose a private RPC node instead of the `https://api.mainnet-beta.solana.com` where one quickly ends up with 429s
* `PORT=3000 GROUP=mainnet.1 CLUSTER_URL=https://api.mainnet-beta.solana.com yarn nodemon ./src/server.ts`
# How to run using docker
* `docker build . -t microwavedcola/mango-service-v3`
* `docker run -p 3000:3000 -e GROUP=mainnet.1 -e CLUSTER_URL=https://api.mainnet-beta.solana.com -v ~/.config:/root/.config microwavedcola/mango-service-v3`
# Notes
You probably want to choose a private RPC node instead of the `https://api.mainnet-beta.solana.com` where one quickly ends up with HTTP 429s
# How to test
* via postman, see `service-v3.postman_collection.json`
* python client, see https://github.com/microwavedcola1/mango-v3-service/blob/master/py/README.md
# Todos
## Small
- cache things like e.g. markets, orders for user
- combine instructions e.g. cancel+place-> modify, cancel many
- missing endpoints
- funding rates?
- maker taker fees
- populate still undefined fields in various endpoints
- todos sprinkled over code
- identify which endpoints are still slow
- when null vs when undefined as return field value,- doublecheck for every endpoint/dto
- how often to load/reload certain mango things e.g. account, cache, rootbanks, etc.?
- cleanup tsconfig.json
- add pre commit tools e.g. husky/pre-commit for code formatting and linting
## Large
- integration with freqtrade and/or ccxt https://github.com/ccxt/ccxt/blob/master/js/ftx.js
- integration with tradingview or https://github.com/thibaultyou/tradingview-alerts-processor/blob/master/docs/2_Alerts.md & https://www.tradingview.com/support/solutions/43000529348-about-webhooks/
## Community feedback
- requests https://twitter.com/microwavedcola1/status/1438439176194727937

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

View File

@ -1,4 +1,4 @@
# py
A python3 client with some examples for the mango markets v3 REST Service
# Pre-requisites
@ -10,7 +10,6 @@ A python3 client with some examples for the mango markets v3 REST Service
* `poetry install`
* `poetry shell`
* `python basic.py`
* ...
# Todos
* add pre-commit e.g. black, pylint, mypy, reorder-python-imports