nilbus / crypto99 Goto Github PK
View Code? Open in Web Editor NEWA crypto coin trade bot and backtester
A crypto coin trade bot and backtester
btc_usd
x_btc
CREATE INDEX ON binance_trades_trx_btc (trade_time);
CREATE INDEX ON binance_trades_adx_btc (trade_time);
CREATE INDEX ON binance_trades_eth_btc (trade_time);
CREATE INDEX ON binance_trades_xlm_btc (trade_time);
CREATE INDEX ON binance_trades_xrp_btc (trade_time);
CREATE INDEX ON binance_trades_btc_usdt (trade_time);
ALTER TABLE binance_trades_trx_btc ADD COLUMN btc_usdt numeric;
ALTER TABLE binance_trades_adx_btc ADD COLUMN btc_usdt numeric;
ALTER TABLE binance_trades_eth_btc ADD COLUMN btc_usdt numeric;
ALTER TABLE binance_trades_xlm_btc ADD COLUMN btc_usdt numeric;
ALTER TABLE binance_trades_xrp_btc ADD COLUMN btc_usdt numeric;
VACUUM ANALYZE VERBOSE;
SELECT 'binance_trades_trx_btc', count(*) FROM binance_trades_trx_btc;
SELECT 'binance_trades_adx_btc', count(*) FROM binance_trades_adx_btc;
SELECT 'binance_trades_eth_btc', count(*) FROM binance_trades_eth_btc;
SELECT 'binance_trades_xlm_btc', count(*) FROM binance_trades_xlm_btc;
SELECT 'binance_trades_xrp_btc', count(*) FROM binance_trades_xrp_btc;
UPDATE binance_trades_eth_btc AS x_btc_outer
SET btc_usdt = converted.USD
FROM (
SELECT
x_btc.binance_trade_id,
x_btc.price x,
btc_usd.price btc_USD,
x_btc.price * btc_usd.price USD,
x_btc.trade_time - btc_usd.trade_time AS time_diff
FROM binance_trades_eth_btc AS x_btc
JOIN LATERAL (
SELECT price, trade_time
FROM binance_trades_btc_usdt AS btc_usd_inner
WHERE x_btc.trade_time > btc_usd_inner.trade_time
ORDER BY btc_usd_inner.trade_time DESC
LIMIT 1
) AS btc_usd ON true
) AS converted
WHERE converted.binance_trade_id = x_btc_outer.binance_trade_id
;
Kill long-running query
SELECT
pid,
now() - pg_stat_activity.query_start AS duration,
query,
state
FROM pg_stat_activity
WHERE (now() - pg_stat_activity.query_start) > interval '5 minutes';
SELECT pg_cancel_backend(__pid__);
result: dataScanner should make importer jump ahead to later id until it finds gaps. The gaps should be filled and scanner will start again until data importer is caught up to live trades. Data Importer will turn itself off and will then assume sockets have taken over. On app restart the importer starts again to close gaps.
result: the data scanner should make the importer 'back up' and fill the gap it left behind
Dependencies: Exchange API, recently history from DB for RecentHistory
Output: Trade events
Same interface as LiveTrader
.
Dependencies: History from DB
Output: Trade events
Controller that coordinates what happens based on incoming trade data.
Communicate with API (or fake for backtesting)
Tracks our current position in memory. Tracks:
Do the magic based on our neural network, etc.
Input: RecentHistory, Position
Output: Buy/Sell/Hold
Stores an in-memory rolling window of transaction history. Stores enough
Input: recent history, either from backtesting or the most recent live data
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.