forked from Ekliptor/WolfBot
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ekliptor
authored and
Ekliptor
committed
Mar 29, 2020
1 parent
a981566
commit 1fdcd42
Showing
5 changed files
with
92 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{ | ||
"data": [ | ||
{ | ||
"exchanges": [ | ||
"Bitfinex" | ||
], | ||
"marginTrading": true, | ||
"tradeTotalBtc": 0, | ||
"warmUpMin": 0, | ||
"updateIndicatorsOnTrade": false, | ||
"flipPosition": false, | ||
"closePositionFirst": false, | ||
"strategies": { | ||
"CandleTester": { | ||
"pair": "USD_BTC", | ||
"candleSize": 1, | ||
"enableLog": true | ||
} | ||
} | ||
} | ||
] | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import * as utils from "@ekliptor/apputils"; | ||
const logger = utils.logger | ||
, nconf = utils.nconf; | ||
import {AbstractStrategy, StrategyAction} from "./AbstractStrategy"; | ||
import {TechnicalStrategy, TechnicalStrategyAction} from "./TechnicalStrategy"; | ||
import {AbstractIndicator} from "../Indicators/AbstractIndicator"; | ||
import {Currency, Trade, Candle} from "@ekliptor/bit-models"; | ||
|
||
interface CandleTesterAction extends TechnicalStrategyAction { | ||
sample: string; | ||
} | ||
|
||
/** | ||
* This strategy just logs candles. | ||
* It is only intended for debugging purposes. | ||
*/ | ||
export default class CandleTester extends TechnicalStrategy { | ||
public action: CandleTesterAction; | ||
protected candleTickCounter: number = 0; // counts the number of candles after start — need for valid calculations with kama | ||
|
||
|
||
constructor(options) { | ||
super(options) | ||
this.addInfoFunction("sample", () => { | ||
return this.action.sample; | ||
}); | ||
} | ||
|
||
public getMinWarumCandles() { | ||
return 0; // ensure we don't start any trade imports with this strategy | ||
} | ||
|
||
// ################################################################ | ||
// ###################### PRIVATE FUNCTIONS ####################### | ||
protected async candleTick(candle: Candle.Candle): Promise<void> { | ||
this.candleTickCounter += 1; | ||
logger.verbose("%s candle: %s CandleTester Market time: %s", | ||
this.candleTickCounter, utils.getUnixTimeStr(true, candle.start), utils.getUnixTimeStr(true, this.marketTime)); | ||
|
||
return super.candleTick(candle); | ||
} | ||
|
||
protected checkIndicators() { | ||
// this strategy does nothing | ||
} | ||
} |
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