Skip to content

Commit

Permalink
add readme code to DemoStrategy
Browse files Browse the repository at this point in the history
  • Loading branch information
AntoineLep committed Apr 22, 2022
1 parent fb7ce82 commit 12100eb
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,11 +285,6 @@ ftx_rest_api: FtxRestApi = FtxRestApi()
Then you can use the FtxRestApi instance to retrieve information from FTX Api. See some examples:

```python

# Retrieve market data
logging.info("Retrieving market price")
response = ftx_rest_api.get(f"markets/BTC-PERP")

# Get last market data
response = ftx_rest_api.get(f"markets/BTC-PERP")
logging.info(f"FTX API response: {str(response)}")
Expand Down
2 changes: 1 addition & 1 deletion config/application_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from strategies.multi_coin_abnormal_volume_tracker.multi_coin_abnormal_volume_tracker \
import MultiCoinAbnormalVolumeTracker

strategy = MultiCoinAbnormalVolumeTracker()
strategy = DemoStrategy()

log = {
"level": "info",
Expand Down
15 changes: 15 additions & 0 deletions strategies/demo_strategy/demo_strategy.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,21 @@ def loop(self) -> None:
if indicators_dataframe is not None:
logging.info(indicators_dataframe['rsi'])

# -------------
# FTX API Calls

# Get last market data
response = self.ftx_rest_api.get(f"markets/BTC-PERP")
logging.info(f"FTX API response: {str(response)}")

# Get open orders on a given market
response = self.ftx_rest_api.get("orders", {"market": "BTC-PERP"})
logging.info(f"FTX API response: {str(response)}")

# Get your account wallet balances
response = self.ftx_rest_api.get("wallet/balances")
logging.info(f"FTX API response: {str(response)}")

def after_loop(self) -> None:
"""Called after each loop"""
logging.info("DemoStrategy after_loop")
Expand Down

0 comments on commit 12100eb

Please sign in to comment.