-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bot comments added, packages updates
- Loading branch information
1 parent
901576a
commit a385051
Showing
14 changed files
with
4,924 additions
and
88 deletions.
There are no files selected for viewing
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
bot: | ||
id: "deimos" | ||
fsm: | ||
isEnabled: true | ||
tradeDelay: 500 | ||
tick: | ||
schedule: "1 */15 * * * *" | ||
scanner: | ||
isEnabled: true | ||
assetDelay: 500 | ||
shortlist: | ||
id: "daily-ema30-cross" | ||
dbName: "strategies_shortlist-daily-ema30-cross" | ||
tick: | ||
schedule: "1 5 * * * *" | ||
|
||
trading: | ||
liveEnabled: false |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
// Create a new Scanner class | ||
class Scanner { | ||
|
||
// Create a constructor that accepts the config, database, utilities, taapiClient, order, and notifications objects | ||
constructor(config, database, utilities, taapiClient, order, notifications) { | ||
this.config = config; | ||
this.database = database; | ||
this.utilities = utilities; | ||
this.taapiClient = taapiClient; | ||
this.order = order; | ||
this.notifications = notifications; | ||
} | ||
|
||
// Mandatory scan() function | ||
async scan() { | ||
|
||
// Post a message to Slack | ||
this.notifications.postSlackMessage(`Scanning...`); | ||
|
||
// Get all USDT pairs from the exchange through TAAPI | ||
this.taapiClient.getNpmClient().getExchangeSymbols("crypto", this.config.exchange.id, "USDT").then( async symbols => { | ||
|
||
// Loop through each symbol | ||
for(let s in symbols) { | ||
|
||
// Get the symbol | ||
let symbol = symbols[s]; | ||
|
||
// Reset bulk queires | ||
this.taapiClient.resetBulkConstructs(); | ||
|
||
// Add RSI calculation | ||
this.taapiClient.addCalculation("rsi", symbol, "1h", "rsi_1h"); | ||
|
||
// Add MACD calculation | ||
this.taapiClient.addCalculation("macd", symbol, "1h", "macd_1h"); | ||
|
||
// Fetch all calculations | ||
await this.taapiClient.executeBulk().then( async ta => { | ||
|
||
// If debug mode is enabled, log the scan item | ||
if(this.config.server.debugMode) { | ||
console.log(`Examining ${s}:${symbol}...`); | ||
} | ||
|
||
// If the RSI is less than 30 and the MACD is greater than the MACD Signal | ||
// then create the trade | ||
if(ta.rsi_1h.value < 30 && ta.macd_1h.valueMACD > ta.macd_1h.valueMACDSignal) { | ||
await this.database.createTrade(this.config.exchange.id, symbol, "1h"); | ||
|
||
// Post a message to Slack | ||
this.notifications.postSlackMessage(`Found trade: ${symbol} on ${this.config.exchange.id} on 1h.`); | ||
} | ||
}); | ||
|
||
// Wait for the configured delay between each asset (rate-limits by TAAPI) | ||
await this.utilities.sleep(this.config.bot.scanner.assetDelay); | ||
}; | ||
|
||
// Post a message to Slack | ||
this.notifications.postSlackMessage(`Scanning complete.`); | ||
}); | ||
} | ||
} | ||
|
||
module.exports = Scanner; |
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 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 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 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 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
Oops, something went wrong.