1 | abstract concept G22TradingStrategy extends ConceptWithChangeListeners { |
2 | settable bool verbose; |
3 | |
4 | gettable S globalID = aGlobalID(); |
5 | |
6 | gettable transient Q q = startQ(); |
7 | |
8 | // link to market (optional) |
9 | transient settable IFuturesMarket market; |
10 | |
11 | settableWithVar S cryptoCoin; |
12 | settableWithVar S marginCoin = "USDT"; |
13 | |
14 | settableWithVar bool usingLiveData; |
15 | settableWithVar bool doingRealTrades; |
16 | settableWithVar bool demoCoin; |
17 | settableWithVar bool active; |
18 | |
19 | // moved to archive (out of main list) |
20 | settableWithVar bool archived; |
21 | |
22 | settableWithVar double adversity = 0.2; |
23 | |
24 | settableWithVar new LS log; |
25 | |
26 | // increment of crypto we can bet on |
27 | settableWithVar double cryptoStep = 0.0001; |
28 | |
29 | // minimum crypto we need to bet on |
30 | settableWithVar double minCrypto = 0.0001; |
31 | |
32 | settableWithVar double maxInvestment; |
33 | |
34 | swappable long currentTime() { ret now(); } |
35 | |
36 | // Note from price feeder |
37 | settableWithVar S feedNote; |
38 | |
39 | void log(O o) { |
40 | if (o != null) { |
41 | log.add(print(str(o))); |
42 | change(); |
43 | } |
44 | } |
45 | |
46 | LS activationStatus() { |
47 | ret llNempties( |
48 | active ? "Active" : "Inactive", |
49 | empty(cryptoCoin) ? null |
50 | : "coin: " + cryptoCoin + " over " + marginCoin |
51 | + stringIf(demoCoin, " (demo coin)"), |
52 | stringIf(market != null, "connected to market"), |
53 | stringIf(usingLiveData, "using live data"), |
54 | stringIf(doingRealTrades, "real trades") |
55 | ); |
56 | } |
57 | |
58 | abstract Cl openPositions(); |
59 | abstract Cl closedPositions(); |
60 | } |
Began life as a copy of #1036209
download show line numbers debug dex old transpilations
Travelled to 2 computer(s): mqqgnosmbjvj, wnsclhtenguj
No comments. add comment
Snippet ID: | #1036258 |
Snippet name: | G22TradingStrategy backup |
Eternal ID of this version: | #1036258/1 |
Text MD5: | c852445735e6a42fb16abc7989348f2a |
Author: | stefan |
Category: | javax / trading |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2022-11-05 20:13:56 |
Source code size: | 1567 bytes / 60 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 177 / 159 |
Referenced in: | [show references] |