Skip to content

Commit

Permalink
Merge pull request #38 from TeamWertarbyte/development
Browse files Browse the repository at this point in the history
Version 2021.2.0
  • Loading branch information
saschb2b authored Feb 27, 2021
2 parents a6a1e5a + ac8fc6d commit 5ff7f43
Show file tree
Hide file tree
Showing 7 changed files with 83 additions and 3 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Cryptocurrency Trading Bot ![version](https://img.shields.io/badge/Version-2021.1.3-blue)
# Cryptocurrency Trading Bot ![version](https://img.shields.io/badge/Version-2021.2.0-blue)
I'm using this bot for a long time now and wanted to share it.

Feel free to make it your own. PRs are welcome!
Expand Down
43 changes: 43 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,48 @@
"s": 9,
"l": 26
}
},
"stableCoins": {
"coins": [
"ANCT",
"BGBP",
"BGBP",
"BITCNY",
"BITEUR",
"BITUSD",
"BUSD",
"CONST",
"CUSD",
"DAI",
"EBASE",
"EURS",
"EUSD",
"EOSDT",
"GUSD",
"HUSD",
"IDRT",
"KRT",
"PAX",
"NIRX",
"QC",
"SBD",
"SDUSD",
"TUSD",
"USDC",
"USDK",
"USDQ",
"USDN",
"USDS",
"USDT",
"USDX",
"USC",
"USNBT",
"UST",
"VNDC",
"WSD",
"XAUT",
"XEUR"
],
"ignore": true
}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "crypto-trading-bot",
"version": "2021.1.3",
"version": "2021.2.0",
"scripts": {
"build": "tsc",
"lint": "eslint \"src/**/*.ts\"",
Expand Down
10 changes: 10 additions & 0 deletions src/modules/bot/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ export default class Bot {
const markets: Market[] = await this.api.getMarkets();

const filtered: Market[] = markets
.filter(({ quoteCurrencySymbol }) =>
this.config.stableCoins.ignore
? !this.config.stableCoins.coins.includes(quoteCurrencySymbol)
: true
)
.filter(({ tags }) =>
this.config.ignoreTokenizedStocks
? !tags.includes('TOKENIZED_SECURITY')
Expand Down Expand Up @@ -107,6 +112,11 @@ export default class Bot {

const balances: Balance[] = (await this.api.getBalances())
.filter(({ available }) => available > 0)
.filter(({ currencySymbol }) =>
this.config.stableCoins.ignore
? !this.config.stableCoins.coins.includes(currencySymbol)
: true
)
.filter(
({ currencySymbol }) => !this.config.HODL.includes(currencySymbol)
);
Expand Down
6 changes: 5 additions & 1 deletion src/modules/configuration/Configuration.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { CandleInterval, MainMarket } from '../api/types';
import { EMAConfiguration } from './types';
import { EMAConfiguration, StableCoinsConfiguration } from './types';

export default interface Configuration {
/**
Expand Down Expand Up @@ -43,6 +43,10 @@ export default interface Configuration {
* Amount in milliseconds to wait before next round
*/
refreshTimeout: number;
/**
* Section for ignoring a set of listed stable coins
*/
stableCoins: StableCoinsConfiguration;
/**
* Defines the interval used for candles
*/
Expand Down
18 changes: 18 additions & 0 deletions src/modules/configuration/Configuration.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,23 @@ export const ConfigurationSchema = {
description: 'Amount in milliseconds to wait before next round',
type: 'number'
},
stableCoins: {
defaultProperties: [],
description: 'Section for ignoring a set of listed stable coins',
properties: {
coins: {
items: {
type: 'string'
},
type: 'array'
},
ignore: {
type: 'boolean'
}
},
required: ['coins', 'ignore'],
type: 'object'
},
tickInterval: {
$ref: '#/definitions/CandleInterval',
description: 'Defines the interval used for candles'
Expand All @@ -146,6 +163,7 @@ export const ConfigurationSchema = {
'mainMarket',
'minNegativeTicks',
'refreshTimeout',
'stableCoins',
'tickInterval'
],
type: 'object'
Expand Down
5 changes: 5 additions & 0 deletions src/modules/configuration/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,8 @@ export type EMAConfiguration = {
default: EMAShortLong;
override?: EMAShortLongOverride[];
};

export type StableCoinsConfiguration = {
coins: string[];
ignore: boolean;
};

0 comments on commit 5ff7f43

Please sign in to comment.