This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Render a text mode progress bar. | |
* | |
* For characters see | |
* | |
* - https://en.wikipedia.org/wiki/Geometric_Shapes_(Unicode_block) | |
* - https://en.wikipedia.org/wiki/Block_Elements | |
* | |
* @param {number} width Width in characters | |
* @param {number} progress Current progress as percent 0....1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM jetbrains/datalore-agent:2024.1 | |
USER root | |
ENV DEBIAN_FRONTEND noninteractive | |
# add deadsnakes ppa and install python 3.11 | |
RUN add-apt-repository ppa:deadsnakes/ppa | |
RUN apt-get update && \ | |
apt-get install -y python3.11 python3.11-venv python3.11-dev && \ | |
rm -rf /var/lib/apt/lists/* && \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Does not create subshell | |
poetry-activate() { | |
source $( poetry env list --full-path | grep Activated | cut -d' ' -f1 )/bin/activate | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This strategy is a momentum and breakout strategy. | |
- The strategy trades ETH and BTC over long term time horizon, doing only few trades per a year. | |
- The strategy delivers similar profits as buying and holding ETH and BTC, but with much less severe drawdowns. | |
- The strategy performs well in long-term Bitcoin [bull market](https://tradingstrategy.ai/glossary/bull-market). | |
- In [bear](https://tradingstrategy.ai/glossary/bear-market) and sideways markets the strategy does not perform well. | |
- It is based on [RSI technical indicator](https://tradingstrategy.ai/glossary/relative-strength-index-rsi), the strategy is buying when others are buying, and the strategy is selling when others are selling. | |
- The strategy deposits excess cash to Aave V3 USDC pool to gain interest on cash | |
- This is the second version of this strategy. [See the earlier version](https://tradingstrategy.ai/strategies/enzyme-polygon-eth-btc-usdc). | |
As the time-in-market os low, the Aave support was added to gain profits on the cash reserves. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def calculate_signal_vs_profit( | |
df, | |
signal_window: pd.Timedelta, | |
profit_window: pd.Timedelta, | |
data_time_bucket: pd.Timedelta, | |
) -> pd.DataFrame: | |
"""Calculate signals and profits for all incoming candles.""" | |
# Create entries for past price to be used for signal | |
# and future price (used for the price correlation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Prints out the latest Cloudflare IP list. | |
# | |
# Note: Third party Cloudflare workers can still access your site even if you | |
# block traffic from this range. | |
# | |
for i in `curl -s https://www.cloudflare.com/ips-v4`; do echo -n "$i "; done | |
for i in `curl -s https://www.cloudflare.com/ips-v6`; do echo -n "$i "; done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Page to display the strategy backtest results. | |
- We are working hard to make iframe resize to work cross-domain, | |
because trade-executor HTML report is being served from a different domain | |
and the web browser policy prevents us to access iframe content to read its internal height | |
- We work around this using a postMessage hack | |
https://stackoverflow.com/a/44547866/315168 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Erigon modified compose. | |
# | |
# - Assumes data volume is mounted at /bsc | |
# - Txpool disabled | |
# | |
# | |
# Useful commands | |
# - logs: docker compose logs --follow erigon | |
# | |
# To start: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Start backend using Gunicorn web server. | |
# | |
# - Run as a standalone UNIX daemon | |
# - Run inside a Docker container | |
# - Read config file for more settings that cannot be given on command line | |
# | |
# See https://docs.gunicorn.org/en/stable/settings.html | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Handle caching of continous aggregate views as SQLAlchemy Table objects. | |
Because reflecting on-spot is too slow: https://github.com/tradingstrategy-ai/backend/pull/63 | |
""" | |
import logging | |
from typing import List, Optional, Dict | |
from sqlalchemy import inspect, MetaData, inspection | |
from sqlalchemy.engine import Engine, Inspector |
NewerOlder