teamwertarbyte / crypto-trading-bot Goto Github PK
View Code? Open in Web Editor NEWA trading bot that does what you order him to do (use at your own risk)
License: MIT License
A trading bot that does what you order him to do (use at your own risk)
License: MIT License
As mentioned here https://bittrexglobal.zendesk.com/hc/en-us/articles/360017498619-Tokenized-Stocks-FAQ some parts of the world are not allowed to trade tokenized stocks.
Original Answer from Bittrex:
"I am XXX and do want to thank you for reaching out to us. You can read more about tokenized stocks here: https://bittrexglobal.zendesk.com/hc/en-us/articles/360017498619-Tokenized-Stocks-FAQ . Per the article users in the European Union, European Economic Zone and other locations mentioned, are not able to trade tokenized stocks."
We should add a boolean flag to ignore those markets
https://api.bittrex.com/v3/markets/NFLX-USDT
{"symbol":"NFLX-USDT","baseCurrencySymbol":"NFLX","quoteCurrencySymbol":"USDT","minTradeSize":"0.00602990","precision":8,"status":"ONLINE","createdAt":"2020-12-02T22:04:28.37Z","prohibitedIn":["US"],"associatedTermsOfService":["TOS_SECURITIES_BERMUDA"],"tags":["TOKENIZED_SECURITY","USE_MIDPOINT_CANDLES"]}
Shows a tag TOKENIZED_SECURITY
which could be used for filtering
The bot is selling / buying EUR - BTC's even when HODL is set to BTC. (ie: HODL: ['BTC'], ['ETH']) and mainMarket = EUR.
I currently don't check for a returned error code from bittrex, just assume it works.
Bittrex return an error object when a problem occured
{
code: string
}
The error codes can be found here
https://bittrex.github.io/api/v3#topic-Error-Codes
Extending the api return types with this object and handling the error cases would be the goal
In your readme.md you mention ./modules/configuration/types.ts
Adapt the config
Change the configuration parameters to your liking config.jsonFor more details see the documentation in ./modules/configuration/types.ts
I think it should be ./modules/configuration/Configuration.ts
Current behavior: All profitable markets are traded within the main market
Wanted behavior: Specific market are only traded within the main market.
An extra optional array in the options could solve this e.g.:
markets: [BTC, ETH, LTC, XLM] // Trades only on those four coins in the defined main market
When array not provided it will proceed as normal with all markets the exchange hast to offer
Thanks for the invite, joined!
Dust are all assets that are in your portfolio but only worth a few bucks. Like 0.24$ of Digibyte.
Currently the bot sees it and thinks "Well we still got some, so I don't need to buy more" or it tries to sell it due to bad EMA but can't due to minimum trading rate being greater of what you hold.
I had like 4-5 dust assets that "blocked" further transactions. But corrected them manually now.
I think with the current implementation we shouldn't get any more dust coins as we use fill_or_kill for selling. So there is no "partially sold" assets
Tldr: Fixed it manually and we shouldn't care about it anyway I think
Originally posted by @saschb2b in #37 (comment)
In your readme.md you mention // await this.report();
This option has now been moved to the config.json file and should be changed in the readme.me
You need more coffee!
FetchError
invalid json response body at https://api.bittrex.com/v3/balances/USDT reason: Unexpected token < in JSON at position 0
I think its something related with node_fetch module
The current reporting fetches the total amount of USDT in the balances and the current BTC price.
For better tracking we need more values that could be sent.
[
{
symbol: "BTC-USDT",
direction: "SELL",
amount: "0.01",
price: "40.000"
}
]
revenue: "7.36"
The problem I see with these metrics is, that we don't know if we actually sold it YET.
We only know we've made an order and hope it goes through. But it should be fine for the first iteration.
Introducing a ReportMetric
type would be a good idea
A boolean in config to use bittrex awards to avoid fees.
Need to be implemented here : https://github.com/TeamWertarbyte/crypto-trading-bot/blob/235120abbe806537c5d68a1d05107134e5d57801/src/modules/api/BittrexApi.ts
Doc : https://bittrex.github.io/api/v3#operation--orders-post
Not sure if this can be done, but it would be nice if the EMA S and L can be set per market.
Something like:
EMA 'BTC S=5 L=10', 'ETH S=3 L=11',
Performance:
This comes due to the limitation of the bittrex api. It only allows ~60requests per minute. So we have some manual wait time between requests to not get blocked.
Sadly this results in the long total amount. We could see which requests we can omit to speed things up. But for now I don't know which.
Stopping buying new coins:
Maybe there isn't any viable option for buying currently? Adding those shouldn't general break the evaluation of other options.
I'll improve the logging to reflect this behavior. Would you mind opening an issue for that?
Originally posted by @saschb2b in #33 (reply in thread)
Call Limits
The Bittrex API employs call limits on all REST endpoints to ensure the efficiency and availability of the platform for all customers. Limits are set such that they should not interfere with legitimate usage patterns. Frequent polling for updates on market data, order status, history, etc. is discouraged and will likely result in your requests failing with a 429 status code. If you need frequent updates, subscribe to the websocket instead of polling. Frivolous order placement and cancellation in a tight loop with low fill rates is also discouraged.
Is your feature request related to a problem? Please describe.
Buying a stable coins means it will just "move" the money and probably won't generate any noticeable profit
Describe the solution you'd like
An config options to ignore stable coins from the buying decisions completely
Additional context
Default should be false to don't break existing configs. Open question would be on how to actually detect which is a "stable" coin and which not
ichimoku was running fine for 2 days now (in a screen), but all of a sudden I got the following error/warning due to an Unexpected token from https://api.bittrex.com/v3/markets/KNC-EUR/ticker
As far as I can see there is nothing wrong with KNC EUR
See log report below.
[13:01:41] ########## Started ichimoku ##########
[13:02:01] Collected revenue 19403.45975 ms
[13:02:01] Fetched 664 and filtered 21 EUR markets 42.75964 ms
[13:02:01] Fetched 664 and filtered 17 market summaries 71.74199 ms
[13:02:28] Evaluated 17 markets in total 27427.01933 ms
[13:02:38] Called report webhook
[13:02:38] ########## Finished 56787.74028 ms ##########
[13:05:38] ########## Started ichimoku ##########
(node:6969) UnhandledPromiseRejectionWarning: FetchError: invalid json response body at https://api.bittrex.com/v3/markets/KNC-EUR/ticker reason: Unexpected token < in JSON at position 0
at /home/bot/node_modules/node-fetch/lib/index.js:272:32
at process._tickCallback (internal/process/next_tick.js:68:7)
(node:6969) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:6969) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
FetchError: request to https://api.bittrex.com/v3/markets/PANDO-USDT/candles/DAY_1/recent failed, reason: read ECONNRESET
File "/usr/src/app/node_modules/node-fetch/lib/index.js", line 1461, col 11, in ClientRequest.
reject(new FetchError(request to ${request.url} failed, reason: ${err.message}
, 'system', err));
File "node:events", line 391, col 22, in ClientRequest.emit
File "node:domain", line 470, col 12, in ClientRequest.EventEmitter.emit
File "node:_http_client", line 462, col 9, in TLSSocket.socketErrorListener
File "node:events", line 379, col 20, in TLSSocket.emit
File "node:domain", line 470, col 12, in TLSSocket.EventEmitter.emit
File "node:internal/streams/destroy", line 188, col 8, in emitErrorNT
File "node:internal/streams/destroy", line 153, col 3, in emitErrorCloseNT
File "node:internal/process/task_queues", line 81, col 21, in processTicksAndRejections
https://github.com/TeamWertarbyte/crypto-trading-bot/blob/master/src/modules/bot/index.ts#L323
Uses a hardcoded USDT
instead of the config value.
if i changed the "BTC" side of things to a common name like "currency" in the code, then set it in the config it should trade that currency (eth, btc, usdt) in the bot as well as what was set in the...
// BTC markets which the bot should watch out for
markets: [
'ZRX',
config section, right?
In this file : https://github.com/TeamWertarbyte/crypto-trading-bot/blob/development/src/modules/bot/index.ts
You are checking if revenue is more than 0 before selling. We can config a minimum revenue before selling.
Sometimes the bot is selling when he makes 10 cents, but with the bittrex commission we are losing money.
I think it would be wise to sell a share only if the revenue including the commission fees are superior to the configurated minimum_revenue.
What do you think about adding a minimum revenue variable?
As the bot can crash we need a way to monitor on why it actually did that.
An optional provided Sentry DNS would be ideal
Currently I've set EMA 9 and EMA 26 hard coded into the bot.
By making them adjustable via the config more options should allow us to test any combination.
const ema26 = ema()
.id(0)
.options({ windowSize: 26 })
.merge((d: CandleReactStockCharts, c: number) => {
d.ema26 = c;
})
.accessor((d: CandleReactStockCharts) => d.ema26);
const ema9 = ema()
.id(1)
.options({ windowSize: 9 })
.merge((d: CandleReactStockCharts, c: number) => {
d.ema9 = c;
})
.accessor((d: CandleReactStockCharts) => d.ema9);
windowSize
needs to be set by config.
Also ema26
and ema9
variable names need a more generic naming schema to prevent confusion.
Is it possible to use MACD instead of the EMA crossover strategy?
I see a MACD indicator in /react-stockcharts/lib/indicator
Will changing "import { ema } from 'react-stockcharts/lib/indicator';" to "import { macd } from 'react-stockcharts/lib/indicator';" be enough to make this work?
A good parameter would be to never reject.
We can do it manually in the config.json but it will be great to hold globally.
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.