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
"""A simple trade execution report database by using Python dataclass, Redis and JSON. | |
- A very simple database for arbitrage trade execution reports. | |
- Dataclasses are serialised and deserialised to JSON that is stored in the Redis. | |
- There is type validation for members and class-types. | |
- Class-types like Decimal are converted back to their original format upon deserialisation. | |
- Optional members are supported and the member presence is validated. | |
- Past trades can be iterated in either order by creation. | |
- A simple CSV exported is provided. |
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 | |
BAK_PATH="${HOME}/.config/quassel-irc.org/quassel-storage.sqlite.bak" | |
CURRENT_PATH="${HOME}/.config/quassel-irc.org/quassel-storage.sqlite" | |
# first day of data that will be maintained | |
# -15 day means that *every* chatline stored before 16 days ago and so on are going to be eliminated. | |
# only the last 15 days are keeped. | |
DATE_TO_PRUNE='-15 day' | |
die() { |
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
"""A stateful event scanner for Ethereum-based blockchains using web3.py. | |
With the stateful mechanism, you can do one batch scan or incremental scans, | |
where events are added where the scanner left last time. | |
Copyright 2021 Mikko Ohtamaa, https://twitter.com/moo9000, licensed under MIT | |
""" | |
import datetime | |
import time |
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
// https://github.com/microsoft/vscode-recipes/tree/master/debugging-jest-tests | |
{ | |
"version": "0.2.0", | |
"configurations": [ | |
{ | |
"type": "node", | |
"request": "launch", | |
"name": "Jest All", | |
"program": "${workspaceFolder}/node_modules/.bin/jest", | |
"args": [ |
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
-- Web3.utils.keccak256("approve(address,uint256)").slice(0, 10); | |
-- '0x095ea7b3' | |
WITH txdata as ( | |
SELECT tx.hash as txid, cast(tx.receipt_gas_used as numeric) * cast(tx.gas_price as numeric) as cost FROM | |
bigquery-public-data.crypto_ethereum.transactions as tx | |
where | |
tx.input | |
LIKE "0x095ea7b3%") | |
SELECT (SUM(cost) / POWER(10, 18)) as eth_cost from txdata; |
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
"""Transaction-aware Celery task handling. | |
Core originally written for Warehouse project https://raw.githubusercontent.com/pypa/warehouse/master/warehouse/celery.py | |
""" | |
from celery import Task | |
from pyramid import scripting | |
from pyramid.interfaces import IRequest | |
from pyramid.request import Request |
NewerOlder