-
Notifications
You must be signed in to change notification settings - Fork 109
/
algorithm_interface.js
101 lines (77 loc) · 2.63 KB
/
algorithm_interface.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
/**
* @param {Application} application
* @param {string} symbol
* @constructor
*/
var AlgorithmTradingInterface = function(application, symbol){};
/**
* @enum {string} Balance Types
*/
AlgorithmTradingInterface.BalanceType = {
DEPOSIT : 'deposit',
LOCKED: 'locked',
AVAILABLE: 'available'
};
/**
* Invoked when your algorithm is ready to run.
* Don't try to send orders before the start method.
* @param {Object.<string,*>} params
*/
AlgorithmTradingInterface.prototype.start = function(params) { };
/**
* Invoked before the system stops your algo. Do your cleanup here
*/
AlgorithmTradingInterface.prototype.stop = function() { };
/**
* Invoked whenever your balance change
* @param {string} currency
* @param {number} balance
* @param {AlgorithmTradingInterface.BalanceType} balance_type
*/
AlgorithmTradingInterface.prototype.onBalanceUpdate = function(currency, balance, balance_type) { };
/**
* Invoked when you update your parameters.
* @param {Object.<string,*>} params
*/
AlgorithmTradingInterface.prototype.onUpdateParams = function(params) { };
/**
* Invoked to report the arrival of a new order, and executions on it.
* @param {Object.<string,string|number>} msg
* @see {http://btobits.com/fixopaedia/fixdic44/message_Execution_Report_8_.html}
*/
AlgorithmTradingInterface.prototype.onExecutionReport = function(msg) { };
/**
* Invoked when there was a change in the order book
* @param {Array.<Array.<number>>} order_book
*/
AlgorithmTradingInterface.prototype.onOrderBookChange = function(order_book) { };
/**
* Invoked when there is a change in the ticker
* @param {Object.<string,string|number>} msg
*/
AlgorithmTradingInterface.prototype.onTicker = function(msg) { };
/**
* Invoked when a new order arrives in the order book
* @param {Object.<string,string|number>} msg
*/
AlgorithmTradingInterface.prototype.onOrderBookNewOrder = function(msg) { };
/**
* Invoked when an order gets updated in the order book
* @param {Object.<string,string|number>} msg
*/
AlgorithmTradingInterface.prototype.onOrderBookUpdateOrder = function(msg) { };
/**
* Invoked when an order gets deleted from the order book
* @param {Object.<string,string|number>} msg
*/
AlgorithmTradingInterface.prototype.onOrderBookDeleteOrder = function(msg) { };
/**
* Invoked when one or more orders gets deleted from the order book
* @param {Object.<string,string|number>} msg
*/
AlgorithmTradingInterface.prototype.onOrderBookDeleteOrdersThru = function(msg) { };
/**
* Invoked when there is a new trade in the exchange
* @param {Object.<string,string|number>} msg
*/
AlgorithmTradingInterface.prototype.onTrade = function(msg) { };