coinrayjs 1.4.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +10 -0
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/candles-cache.d.ts +7 -0
- package/dist/candles-cache.js +57 -0
- package/dist/candles-cache.js.map +1 -0
- package/dist/coinray-cache.d.ts +30 -0
- package/dist/coinray-cache.js +109 -0
- package/dist/coinray-cache.js.map +1 -0
- package/dist/coinray.d.ts +156 -0
- package/dist/coinray.js +957 -0
- package/dist/coinray.js.map +1 -0
- package/dist/crypto.d.ts +1 -0
- package/dist/crypto.js +57 -0
- package/dist/crypto.js.map +1 -0
- package/dist/current-market.d.ts +61 -0
- package/dist/current-market.js +259 -0
- package/dist/current-market.js.map +1 -0
- package/dist/errors.d.ts +25 -0
- package/dist/errors.js +50 -0
- package/dist/errors.js.map +1 -0
- package/dist/event-emitter.d.ts +9 -0
- package/dist/event-emitter.js +36 -0
- package/dist/event-emitter.js.map +1 -0
- package/dist/exchange.d.ts +28 -0
- package/dist/exchange.js +107 -0
- package/dist/exchange.js.map +1 -0
- package/dist/i18n/locales.d.ts +21 -0
- package/dist/i18n/locales.js +21 -0
- package/dist/i18n/locales.js.map +1 -0
- package/dist/i18n.d.ts +4 -0
- package/dist/i18n.js +16 -0
- package/dist/i18n.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -0
- package/dist/lru.d.ts +26 -0
- package/dist/lru.js +93 -0
- package/dist/lru.js.map +1 -0
- package/dist/market.d.ts +46 -0
- package/dist/market.js +117 -0
- package/dist/market.js.map +1 -0
- package/dist/orders/base.d.ts +29 -0
- package/dist/orders/base.js +47 -0
- package/dist/orders/base.js.map +1 -0
- package/dist/orders/index.d.ts +6 -0
- package/dist/orders/index.js +7 -0
- package/dist/orders/index.js.map +1 -0
- package/dist/orders/limit-ladder.d.ts +87 -0
- package/dist/orders/limit-ladder.js +229 -0
- package/dist/orders/limit-ladder.js.map +1 -0
- package/dist/orders/limit.d.ts +47 -0
- package/dist/orders/limit.js +86 -0
- package/dist/orders/limit.js.map +1 -0
- package/dist/orders/market.d.ts +35 -0
- package/dist/orders/market.js +52 -0
- package/dist/orders/market.js.map +1 -0
- package/dist/orders/oco.d.ts +54 -0
- package/dist/orders/oco.js +70 -0
- package/dist/orders/oco.js.map +1 -0
- package/dist/orders/stop-limit.d.ts +42 -0
- package/dist/orders/stop-limit.js +33 -0
- package/dist/orders/stop-limit.js.map +1 -0
- package/dist/orders/validate.d.ts +2 -0
- package/dist/orders/validate.js +6 -0
- package/dist/orders/validate.js.map +1 -0
- package/dist/trade.d.ts +10 -0
- package/dist/trade.js +32 -0
- package/dist/trade.js.map +1 -0
- package/dist/types.d.ts +185 -0
- package/dist/types.js +42 -0
- package/dist/types.js.map +1 -0
- package/dist/util.d.ts +33 -0
- package/dist/util.js +212 -0
- package/dist/util.js.map +1 -0
- package/package.json +79 -0
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { BalanceLimit, OrderType } from "../types";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import LimitOrder, { LimitOrderParams } from "./limit";
|
|
4
|
+
import BaseOrder from "./base";
|
|
5
|
+
export declare enum PriceScales {
|
|
6
|
+
LINEAR = "LINEAR",
|
|
7
|
+
EXPONENTIAL = "EXPONENTIAL",
|
|
8
|
+
FIBONACCI = "FIBONACCI",
|
|
9
|
+
CUSTOM = "CUSTOM"
|
|
10
|
+
}
|
|
11
|
+
export declare enum SizeScales {
|
|
12
|
+
EQUAL = "EQUAL",
|
|
13
|
+
LINEAR = "LINEAR",
|
|
14
|
+
LINEAR_REVERSE = "LINEAR_REVERSE",
|
|
15
|
+
EXPONENTIAL = "EXPONENTIAL",
|
|
16
|
+
EXPONENTIAL_REVERSE = "EXPONENTIAL_REVERSE",
|
|
17
|
+
CUSTOM = "CUSTOM"
|
|
18
|
+
}
|
|
19
|
+
interface LimitLadderOrderParams extends LimitOrderParams {
|
|
20
|
+
otherPrice: BigNumber;
|
|
21
|
+
numOrders: number;
|
|
22
|
+
priceScale?: PriceScales;
|
|
23
|
+
sizeScale?: SizeScales;
|
|
24
|
+
priceScales?: Array<number>;
|
|
25
|
+
sizeScales?: Array<number>;
|
|
26
|
+
}
|
|
27
|
+
export default class LimitLadderOrder extends BaseOrder {
|
|
28
|
+
baseAmount: BigNumber;
|
|
29
|
+
quoteAmount: BigNumber;
|
|
30
|
+
price: BigNumber;
|
|
31
|
+
lockedOn: string;
|
|
32
|
+
otherPrice: BigNumber;
|
|
33
|
+
numOrders: number;
|
|
34
|
+
priceScale: PriceScales;
|
|
35
|
+
sizeScale: SizeScales;
|
|
36
|
+
priceScales: Array<number>;
|
|
37
|
+
sizeScales: Array<number>;
|
|
38
|
+
balanceLimit: BalanceLimit;
|
|
39
|
+
orderType: OrderType;
|
|
40
|
+
constraints(): {
|
|
41
|
+
baseAmount: {
|
|
42
|
+
bigNumericality: {
|
|
43
|
+
greaterThanOrEqualTo: number;
|
|
44
|
+
notGreaterThanOrEqualTo: string;
|
|
45
|
+
lessThanOrEqualTo: any;
|
|
46
|
+
notLessThanOrEqualTo: string;
|
|
47
|
+
};
|
|
48
|
+
};
|
|
49
|
+
quoteAmount: {
|
|
50
|
+
bigNumericality: {
|
|
51
|
+
greaterThanOrEqualTo: number;
|
|
52
|
+
notGreaterThanOrEqualTo: string;
|
|
53
|
+
lessThanOrEqualTo: any;
|
|
54
|
+
notLessThanOrEqualTo: string;
|
|
55
|
+
};
|
|
56
|
+
};
|
|
57
|
+
price: {
|
|
58
|
+
bigNumericality: {
|
|
59
|
+
greaterThan: number;
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
otherPrice: {
|
|
63
|
+
bigNumericality: {
|
|
64
|
+
greaterThan: number;
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
numOrders: {
|
|
68
|
+
numericality: {
|
|
69
|
+
greaterThanOrEqualTo: number;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
constructor(params: LimitLadderOrderParams);
|
|
74
|
+
updateNumOrders(numOrders: number): void;
|
|
75
|
+
updatePrice(price: BigNumber, priceOffset?: number): void;
|
|
76
|
+
updateOtherPrice(otherPrice: BigNumber, priceOffset?: number): void;
|
|
77
|
+
updatePriceScales(priceScales: Array<number>): void;
|
|
78
|
+
updatePriceScale(priceScale: PriceScales): void;
|
|
79
|
+
updateSizeScales(sizeScales: Array<number>): void;
|
|
80
|
+
updateSizeScale(sizeScale: SizeScales): void;
|
|
81
|
+
updateLockedOn(lockedOn: string): void;
|
|
82
|
+
recalculate(): void;
|
|
83
|
+
updateQuoteAmount(quoteAmount: BigNumber): void;
|
|
84
|
+
updateBaseAmount(baseAmount: BigNumber): void;
|
|
85
|
+
getOrders(lockedOn?: string): Array<LimitOrder>;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import { BalanceLimit, OrderSide, OrderType } from "../types";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import LimitOrder from "./limit";
|
|
4
|
+
import _ from "lodash";
|
|
5
|
+
import { correctNumberPrecision, safeBigNumber, safeInteger } from "../util";
|
|
6
|
+
import BaseOrder from "./base";
|
|
7
|
+
import Coinray from "../coinray";
|
|
8
|
+
export var PriceScales;
|
|
9
|
+
(function (PriceScales) {
|
|
10
|
+
PriceScales["LINEAR"] = "LINEAR";
|
|
11
|
+
PriceScales["EXPONENTIAL"] = "EXPONENTIAL";
|
|
12
|
+
PriceScales["FIBONACCI"] = "FIBONACCI";
|
|
13
|
+
PriceScales["CUSTOM"] = "CUSTOM";
|
|
14
|
+
})(PriceScales || (PriceScales = {}));
|
|
15
|
+
export var SizeScales;
|
|
16
|
+
(function (SizeScales) {
|
|
17
|
+
SizeScales["EQUAL"] = "EQUAL";
|
|
18
|
+
SizeScales["LINEAR"] = "LINEAR";
|
|
19
|
+
SizeScales["LINEAR_REVERSE"] = "LINEAR_REVERSE";
|
|
20
|
+
SizeScales["EXPONENTIAL"] = "EXPONENTIAL";
|
|
21
|
+
SizeScales["EXPONENTIAL_REVERSE"] = "EXPONENTIAL_REVERSE";
|
|
22
|
+
SizeScales["CUSTOM"] = "CUSTOM";
|
|
23
|
+
})(SizeScales || (SizeScales = {}));
|
|
24
|
+
const PRICE_SCALES = {
|
|
25
|
+
[PriceScales.LINEAR]: (numOrders) => {
|
|
26
|
+
return _.times(numOrders, (index) => (1 / (numOrders - 1)) * index);
|
|
27
|
+
},
|
|
28
|
+
[PriceScales.EXPONENTIAL]: (numOrders) => {
|
|
29
|
+
const sum = Math.pow(2, (numOrders - 1));
|
|
30
|
+
return _.times(numOrders, (index) => index == 0 ? 0 : (Math.pow(2, index)) / sum);
|
|
31
|
+
},
|
|
32
|
+
[PriceScales.FIBONACCI]: (numOrders) => {
|
|
33
|
+
const numbers = [0, 0.09, 0.146, 0.236, 0.382, 0.5, 0.618, 0.788, 0.886];
|
|
34
|
+
return numbers.slice(0, numOrders - 1).concat([1]); // always make sure the last number is 1
|
|
35
|
+
},
|
|
36
|
+
[PriceScales.CUSTOM]: (numOrders) => {
|
|
37
|
+
return [];
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
const normalizeSizeScale = (scale) => {
|
|
41
|
+
const sum = _.sum(scale);
|
|
42
|
+
return scale.map((value) => value / sum);
|
|
43
|
+
};
|
|
44
|
+
const SIZE_SCALES = {
|
|
45
|
+
[SizeScales.EQUAL]: (numOrders) => {
|
|
46
|
+
const scale = _.times(numOrders, () => 1);
|
|
47
|
+
return normalizeSizeScale(scale);
|
|
48
|
+
},
|
|
49
|
+
[SizeScales.LINEAR]: (numOrders) => {
|
|
50
|
+
const scale = _.times(numOrders, (index) => (1 / (numOrders)) * (index + 1));
|
|
51
|
+
return normalizeSizeScale(scale);
|
|
52
|
+
},
|
|
53
|
+
[SizeScales.EXPONENTIAL]: (numOrders) => {
|
|
54
|
+
const sum = Math.pow(2, numOrders) - 1;
|
|
55
|
+
const scale = _.times(numOrders, (index) => (Math.pow(2, index)) / sum);
|
|
56
|
+
return normalizeSizeScale(scale);
|
|
57
|
+
},
|
|
58
|
+
[SizeScales.LINEAR_REVERSE]: (numOrders) => {
|
|
59
|
+
return SIZE_SCALES[SizeScales.LINEAR](numOrders).reverse();
|
|
60
|
+
},
|
|
61
|
+
[SizeScales.EXPONENTIAL_REVERSE]: (numOrders) => {
|
|
62
|
+
return SIZE_SCALES[SizeScales.EXPONENTIAL](numOrders).reverse();
|
|
63
|
+
},
|
|
64
|
+
[SizeScales.CUSTOM]: (numOrders) => {
|
|
65
|
+
return [];
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
export default class LimitLadderOrder extends BaseOrder {
|
|
69
|
+
constructor(params) {
|
|
70
|
+
super(params);
|
|
71
|
+
this.orderType = OrderType.LIMIT_LADDER;
|
|
72
|
+
this.otherPrice = safeBigNumber(params.otherPrice);
|
|
73
|
+
this.numOrders = safeInteger(params.numOrders);
|
|
74
|
+
this.priceScale = params.priceScale || PriceScales.CUSTOM;
|
|
75
|
+
this.sizeScale = params.sizeScale || SizeScales.CUSTOM;
|
|
76
|
+
this.price = safeBigNumber(params.price || "0");
|
|
77
|
+
this.lockedOn = params.lockedOn;
|
|
78
|
+
this.baseAmount = safeBigNumber(params.baseAmount || "0");
|
|
79
|
+
this.quoteAmount = safeBigNumber(params.quoteAmount || "0");
|
|
80
|
+
this.priceScales = params.priceScales || PRICE_SCALES[this.priceScale](this.numOrders);
|
|
81
|
+
this.sizeScales = params.sizeScales || SIZE_SCALES[this.sizeScale](this.numOrders);
|
|
82
|
+
if (this.quoteAmount.gt(0) && this.lockedOn === "quoteAmount") {
|
|
83
|
+
this.updateQuoteAmount(this.quoteAmount);
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
this.updateBaseAmount(this.baseAmount);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
constraints() {
|
|
90
|
+
let maxBase = undefined;
|
|
91
|
+
let maxQuote = undefined;
|
|
92
|
+
if (this.balanceLimit === BalanceLimit.QUOTE) {
|
|
93
|
+
maxQuote = this.balances.quote;
|
|
94
|
+
}
|
|
95
|
+
else if (this.balanceLimit === BalanceLimit.BASE) {
|
|
96
|
+
maxBase = this.balances.base;
|
|
97
|
+
}
|
|
98
|
+
return {
|
|
99
|
+
baseAmount: {
|
|
100
|
+
bigNumericality: {
|
|
101
|
+
greaterThanOrEqualTo: this.minBase.toNumber(),
|
|
102
|
+
notGreaterThanOrEqualTo: `^${Coinray.I18n.t("validation.notGreaterThanOrEqualTo", { min: correctNumberPrecision(this.precisionBase, this.minBase) })}`,
|
|
103
|
+
lessThanOrEqualTo: maxBase ? maxBase.toNumber() : undefined,
|
|
104
|
+
notLessThanOrEqualTo: `^${Coinray.I18n.t("validation.insufficientFunds")}`,
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
quoteAmount: {
|
|
108
|
+
bigNumericality: {
|
|
109
|
+
greaterThanOrEqualTo: this.minQuote.toNumber(),
|
|
110
|
+
notGreaterThanOrEqualTo: `^${Coinray.I18n.t("validation.notGreaterThanOrEqualTo", { min: correctNumberPrecision(this.precisionQuote, this.minQuote) })}`,
|
|
111
|
+
lessThanOrEqualTo: maxQuote ? maxQuote.toNumber() : undefined,
|
|
112
|
+
notLessThanOrEqualTo: `^${Coinray.I18n.t("validation.insufficientFunds")}`,
|
|
113
|
+
}
|
|
114
|
+
},
|
|
115
|
+
price: {
|
|
116
|
+
bigNumericality: {
|
|
117
|
+
greaterThan: 0,
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
otherPrice: {
|
|
121
|
+
bigNumericality: {
|
|
122
|
+
greaterThan: 0,
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
numOrders: {
|
|
126
|
+
numericality: {
|
|
127
|
+
greaterThanOrEqualTo: 2,
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
updateNumOrders(numOrders) {
|
|
133
|
+
this.numOrders = numOrders;
|
|
134
|
+
}
|
|
135
|
+
updatePrice(price, priceOffset = 0.05) {
|
|
136
|
+
this.price = price.decimalPlaces(this.precisionPrice);
|
|
137
|
+
if (price && this.otherPrice.eq(0)) {
|
|
138
|
+
const offset = this.side === OrderSide.BUY ? 1 + priceOffset : 1 - priceOffset;
|
|
139
|
+
this.otherPrice = price.multipliedBy(offset).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
|
|
140
|
+
}
|
|
141
|
+
this.recalculate();
|
|
142
|
+
}
|
|
143
|
+
updateOtherPrice(otherPrice, priceOffset = 0.05) {
|
|
144
|
+
this.otherPrice = otherPrice.decimalPlaces(this.precisionPrice);
|
|
145
|
+
if (otherPrice && this.price.eq(0)) {
|
|
146
|
+
const offset = this.side === OrderSide.BUY ? 1 - priceOffset : 1 + priceOffset;
|
|
147
|
+
this.price = otherPrice.multipliedBy(offset).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0);
|
|
148
|
+
}
|
|
149
|
+
this.recalculate();
|
|
150
|
+
}
|
|
151
|
+
updatePriceScales(priceScales) {
|
|
152
|
+
this.priceScales = priceScales;
|
|
153
|
+
this.priceScale = PriceScales.CUSTOM;
|
|
154
|
+
this.recalculate();
|
|
155
|
+
}
|
|
156
|
+
updatePriceScale(priceScale) {
|
|
157
|
+
this.priceScales = PRICE_SCALES[priceScale](this.numOrders);
|
|
158
|
+
this.priceScale = priceScale;
|
|
159
|
+
this.recalculate();
|
|
160
|
+
}
|
|
161
|
+
updateSizeScales(sizeScales) {
|
|
162
|
+
this.sizeScales = sizeScales;
|
|
163
|
+
this.sizeScale = SizeScales.CUSTOM;
|
|
164
|
+
this.recalculate();
|
|
165
|
+
}
|
|
166
|
+
updateSizeScale(sizeScale) {
|
|
167
|
+
this.sizeScales = SIZE_SCALES[sizeScale](this.numOrders);
|
|
168
|
+
this.sizeScale = sizeScale;
|
|
169
|
+
this.recalculate();
|
|
170
|
+
}
|
|
171
|
+
updateLockedOn(lockedOn) {
|
|
172
|
+
this.lockedOn = lockedOn;
|
|
173
|
+
}
|
|
174
|
+
recalculate() {
|
|
175
|
+
if (this.lockedOn === "baseAmount") {
|
|
176
|
+
this.updateBaseAmount(this.baseAmount);
|
|
177
|
+
}
|
|
178
|
+
else {
|
|
179
|
+
this.updateQuoteAmount(this.quoteAmount);
|
|
180
|
+
}
|
|
181
|
+
this.validate();
|
|
182
|
+
}
|
|
183
|
+
updateQuoteAmount(quoteAmount) {
|
|
184
|
+
this.quoteAmount = quoteAmount;
|
|
185
|
+
this.numOrders = Math.max(2, +this.numOrders);
|
|
186
|
+
const orders = this.getOrders("quoteAmount");
|
|
187
|
+
if (orders.length > 0) {
|
|
188
|
+
this.baseAmount = _.reduce(orders, (sum, order) => {
|
|
189
|
+
return sum.plus(order.baseAmount);
|
|
190
|
+
}, new BigNumber(0));
|
|
191
|
+
}
|
|
192
|
+
else {
|
|
193
|
+
this.baseAmount = new BigNumber(0);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
updateBaseAmount(baseAmount) {
|
|
197
|
+
this.baseAmount = baseAmount;
|
|
198
|
+
this.numOrders = Math.max(2, +this.numOrders);
|
|
199
|
+
const orders = this.getOrders("baseAmount");
|
|
200
|
+
if (orders.length > 0) {
|
|
201
|
+
this.quoteAmount = _.reduce(orders, (sum, order) => {
|
|
202
|
+
return sum.plus(order.quoteAmount);
|
|
203
|
+
}, new BigNumber(0));
|
|
204
|
+
}
|
|
205
|
+
else {
|
|
206
|
+
this.quoteAmount = new BigNumber(0);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
getOrders(lockedOn = this.lockedOn) {
|
|
210
|
+
const lockedOnAmount = lockedOn === "baseAmount" ? this.baseAmount : this.quoteAmount;
|
|
211
|
+
const precisionAmount = lockedOn === "baseAmount" ? this.precisionBase : this.precisionQuote;
|
|
212
|
+
if (!(this.priceScales && this.priceScales.length > 0 && this.sizeScales.length > 0 && lockedOnAmount.gt(0))) {
|
|
213
|
+
return [];
|
|
214
|
+
}
|
|
215
|
+
const priceScales = this.priceScales.slice(0, this.numOrders);
|
|
216
|
+
const sizeScales = this.sizeScales.slice(0, this.numOrders);
|
|
217
|
+
const diff = this.otherPrice.minus(this.price);
|
|
218
|
+
let amountRemaining = lockedOnAmount;
|
|
219
|
+
return _.times(this.numOrders, (index) => {
|
|
220
|
+
let amount = lockedOnAmount.multipliedBy(sizeScales[index]).decimalPlaces(precisionAmount > 0 ? precisionAmount : 0, BigNumber.ROUND_DOWN);
|
|
221
|
+
amountRemaining = amountRemaining.minus(amount);
|
|
222
|
+
if (index === this.numOrders - 1) {
|
|
223
|
+
amount = amount.plus(amountRemaining);
|
|
224
|
+
}
|
|
225
|
+
return new LimitOrder(Object.assign(Object.assign({}, this), { [lockedOn]: amount, lockedOn, price: this.price.plus(diff.multipliedBy(priceScales[index])).decimalPlaces(this.precisionPrice > 0 ? this.precisionPrice : 0) }));
|
|
226
|
+
});
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
//# sourceMappingURL=limit-ladder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit-ladder.js","sourceRoot":"","sources":["../../lib/orders/limit-ladder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,UAAU,CAAC;AAC5D,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,UAA8B,MAAM,SAAS,CAAC;AACrD,OAAO,CAAC,MAAM,QAAQ,CAAA;AACtB,OAAO,EAAC,sBAAsB,EAAE,aAAa,EAAE,WAAW,EAAC,MAAM,SAAS,CAAC;AAC3E,OAAO,SAAS,MAAM,QAAQ,CAAC;AAC/B,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC,MAAM,CAAN,IAAY,WAKX;AALD,WAAY,WAAW;IACrB,gCAA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AAC,CAAA;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import BaseOrder from "./base";
|
|
2
|
+
import { BalanceLimit, BaseOrderParams, OrderType } from "../types";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
export interface LimitOrderParams extends BaseOrderParams {
|
|
5
|
+
baseAmount: BigNumber;
|
|
6
|
+
quoteAmount: BigNumber;
|
|
7
|
+
price: BigNumber;
|
|
8
|
+
lockedOn: string;
|
|
9
|
+
}
|
|
10
|
+
export default class LimitOrder extends BaseOrder {
|
|
11
|
+
baseAmount: BigNumber;
|
|
12
|
+
quoteAmount: BigNumber;
|
|
13
|
+
price: BigNumber;
|
|
14
|
+
lockedOn: string;
|
|
15
|
+
balanceLimit: BalanceLimit;
|
|
16
|
+
orderType: OrderType;
|
|
17
|
+
constraints(): {
|
|
18
|
+
baseAmount: {
|
|
19
|
+
bigNumericality: {
|
|
20
|
+
greaterThanOrEqualTo: number;
|
|
21
|
+
notGreaterThanOrEqualTo: string;
|
|
22
|
+
lessThanOrEqualTo: any;
|
|
23
|
+
notLessThanOrEqualTo: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
quoteAmount: {
|
|
27
|
+
bigNumericality: {
|
|
28
|
+
greaterThanOrEqualTo: number;
|
|
29
|
+
notGreaterThanOrEqualTo: string;
|
|
30
|
+
lessThanOrEqualTo: any;
|
|
31
|
+
notLessThanOrEqualTo: string;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
price: {
|
|
35
|
+
bigNumericality: {
|
|
36
|
+
greaterThan: number;
|
|
37
|
+
};
|
|
38
|
+
};
|
|
39
|
+
};
|
|
40
|
+
constructor(params: LimitOrderParams, updateAmounts?: boolean);
|
|
41
|
+
updateBaseAmount(baseAmount: BigNumber): void;
|
|
42
|
+
updateQuoteAmount(quoteAmount: BigNumber): void;
|
|
43
|
+
updateLockedOn(lockedOn: string): void;
|
|
44
|
+
quoteFee(): BigNumber;
|
|
45
|
+
updatePrice(price: BigNumber): void;
|
|
46
|
+
getOrders(): Array<BaseOrder>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import BaseOrder from "./base";
|
|
2
|
+
import { BalanceLimit, OrderType } from "../types";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
import { correctNumberPrecision, safeBigNumber } from "../util";
|
|
5
|
+
import Coinray from "../coinray";
|
|
6
|
+
export default class LimitOrder extends BaseOrder {
|
|
7
|
+
constructor(params, updateAmounts = true) {
|
|
8
|
+
super(params);
|
|
9
|
+
this.orderType = OrderType.LIMIT;
|
|
10
|
+
this.price = safeBigNumber(params.price || "0");
|
|
11
|
+
this.lockedOn = params.lockedOn;
|
|
12
|
+
this.baseAmount = safeBigNumber(params.baseAmount);
|
|
13
|
+
this.quoteAmount = safeBigNumber(params.quoteAmount);
|
|
14
|
+
if (updateAmounts) {
|
|
15
|
+
if (this.quoteAmount.gt(0) && this.lockedOn === "quoteAmount") {
|
|
16
|
+
this.updateQuoteAmount(this.quoteAmount);
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
this.updateBaseAmount(this.baseAmount);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
constraints() {
|
|
24
|
+
let maxBase = undefined;
|
|
25
|
+
let maxQuote = undefined;
|
|
26
|
+
if (this.balanceLimit === BalanceLimit.QUOTE) {
|
|
27
|
+
maxQuote = this.balances.quote || 0;
|
|
28
|
+
}
|
|
29
|
+
else if (this.balanceLimit === BalanceLimit.BASE) {
|
|
30
|
+
maxBase = this.balances.base || 0;
|
|
31
|
+
}
|
|
32
|
+
return {
|
|
33
|
+
baseAmount: {
|
|
34
|
+
bigNumericality: {
|
|
35
|
+
greaterThanOrEqualTo: this.minBase.toNumber(),
|
|
36
|
+
notGreaterThanOrEqualTo: `^${Coinray.I18n.t("validation.notGreaterThanOrEqualTo", { min: correctNumberPrecision(this.precisionBase, this.minBase) })}`,
|
|
37
|
+
lessThanOrEqualTo: maxBase ? maxBase.toNumber() : undefined,
|
|
38
|
+
notLessThanOrEqualTo: `^${Coinray.I18n.t("validation.insufficientFunds")}`,
|
|
39
|
+
}
|
|
40
|
+
},
|
|
41
|
+
quoteAmount: {
|
|
42
|
+
bigNumericality: {
|
|
43
|
+
greaterThanOrEqualTo: this.minQuote.toNumber(),
|
|
44
|
+
notGreaterThanOrEqualTo: `^${Coinray.I18n.t("validation.notGreaterThanOrEqualTo", { min: correctNumberPrecision(this.precisionQuote, this.minQuote) })}`,
|
|
45
|
+
lessThanOrEqualTo: maxQuote ? maxQuote.toNumber() : undefined,
|
|
46
|
+
notLessThanOrEqualTo: `^${Coinray.I18n.t("validation.insufficientFunds")}`,
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
price: {
|
|
50
|
+
bigNumericality: {
|
|
51
|
+
greaterThan: 0,
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
updateBaseAmount(baseAmount) {
|
|
57
|
+
this.baseAmount = baseAmount;
|
|
58
|
+
this.quoteAmount = this.price.multipliedBy(this.baseAmount).decimalPlaces(this.precisionQuote > 0 ? this.precisionQuote : 0, BigNumber.ROUND_DOWN);
|
|
59
|
+
this.validate();
|
|
60
|
+
}
|
|
61
|
+
updateQuoteAmount(quoteAmount) {
|
|
62
|
+
this.quoteAmount = quoteAmount;
|
|
63
|
+
this.baseAmount = quoteAmount.dividedBy(this.price).decimalPlaces(this.precisionBase > 0 ? this.precisionBase : 0, BigNumber.ROUND_DOWN);
|
|
64
|
+
this.validate();
|
|
65
|
+
}
|
|
66
|
+
updateLockedOn(lockedOn) {
|
|
67
|
+
this.lockedOn = lockedOn;
|
|
68
|
+
this.validate();
|
|
69
|
+
}
|
|
70
|
+
quoteFee() {
|
|
71
|
+
return this.quoteAmount.multipliedBy(this.takerFee);
|
|
72
|
+
}
|
|
73
|
+
updatePrice(price) {
|
|
74
|
+
this.price = price.decimalPlaces(this.precisionPrice);
|
|
75
|
+
if (this.lockedOn === "baseAmount") {
|
|
76
|
+
this.updateBaseAmount(this.baseAmount);
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
this.updateQuoteAmount(this.quoteAmount);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
getOrders() {
|
|
83
|
+
return [this];
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=limit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limit.js","sourceRoot":"","sources":["../../lib/orders/limit.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAmB,SAAS,EAAC,MAAM,UAAU,CAAC;AAClE,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAC,sBAAsB,EAAE,aAAa,EAAC,MAAM,SAAS,CAAC;AAC9D,OAAO,OAAO,MAAM,YAAY,CAAC;AASjC,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,SAAS;IA2C/C,YAAY,MAAwB,EAAE,aAAa,GAAG,IAAI;QACxD,KAAK,CAAC,MAAM,CAAC,CAAC;QArChB,cAAS,GAAG,SAAS,CAAC,KAAK,CAAC;QAsC1B,IAAI,CAAC,KAAK,GAAG,aAAa,CAAC,MAAM,CAAC,KAAK,IAAI,GAAG,CAAC,CAAC;QAChD,IAAI,CAAC,QAAQ,GAAG,MAAM,CAAC,QAAQ,CAAC;QAChC,IAAI,CAAC,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;QACnD,IAAI,CAAC,WAAW,GAAG,aAAa,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAErD,IAAI,aAAa,EAAE;YACjB,IAAI,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,KAAK,aAAa,EAAE;gBAC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,CAAC;IAED,WAAW,CAAC,KAAgB;QAC1B,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAEtD,IAAI,IAAI,CAAC,QAAQ,KAAK,YAAY,EAAE;YAClC,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,UAAU,CAAC,CAAA;SACvC;aAAM;YACL,IAAI,CAAC,iBAAiB,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;SACzC;IACH,CAAC;IAED,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import BaseOrder from "./base";
|
|
2
|
+
import { BaseOrderParams, OrderType } from "../types";
|
|
3
|
+
import BigNumber from "bignumber.js";
|
|
4
|
+
interface MarketOrderParams extends BaseOrderParams {
|
|
5
|
+
quoteAmount?: BigNumber;
|
|
6
|
+
baseAmount?: BigNumber;
|
|
7
|
+
}
|
|
8
|
+
export default class MarketOrder extends BaseOrder {
|
|
9
|
+
baseAmount?: BigNumber;
|
|
10
|
+
quoteAmount?: BigNumber;
|
|
11
|
+
orderType: OrderType;
|
|
12
|
+
constraints: () => {
|
|
13
|
+
baseAmount: {
|
|
14
|
+
bigNumericality: {
|
|
15
|
+
greaterThanOrEqualTo: number;
|
|
16
|
+
notGreaterThanOrEqualTo: string;
|
|
17
|
+
lessThanOrEqualTo: any;
|
|
18
|
+
notLessThanOrEqualTo: string;
|
|
19
|
+
};
|
|
20
|
+
};
|
|
21
|
+
quoteAmount: {
|
|
22
|
+
bigNumericality: {
|
|
23
|
+
greaterThanOrEqualTo: number;
|
|
24
|
+
notGreaterThanOrEqualTo: string;
|
|
25
|
+
lessThanOrEqualTo: any;
|
|
26
|
+
notLessThanOrEqualTo: string;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
constructor(params: MarketOrderParams);
|
|
31
|
+
updateBaseAmount(baseAmount: BigNumber): void;
|
|
32
|
+
updateQuoteAmount(quoteAmount: BigNumber): void;
|
|
33
|
+
getOrders(): Array<BaseOrder>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import BaseOrder from "./base";
|
|
2
|
+
import { BalanceLimit, OrderType } from "../types";
|
|
3
|
+
import Coinray from "../coinray";
|
|
4
|
+
import { correctNumberPrecision } from "../util";
|
|
5
|
+
export default class MarketOrder extends BaseOrder {
|
|
6
|
+
constructor(params) {
|
|
7
|
+
super(params);
|
|
8
|
+
this.orderType = OrderType.MARKET;
|
|
9
|
+
this.constraints = () => {
|
|
10
|
+
let maxBase = undefined;
|
|
11
|
+
let maxQuote = undefined;
|
|
12
|
+
if (this.balanceLimit === BalanceLimit.QUOTE) {
|
|
13
|
+
maxQuote = this.balances.quote || 0;
|
|
14
|
+
}
|
|
15
|
+
else if (this.balanceLimit === BalanceLimit.BASE) {
|
|
16
|
+
maxBase = this.balances.base || 0;
|
|
17
|
+
}
|
|
18
|
+
return {
|
|
19
|
+
baseAmount: {
|
|
20
|
+
bigNumericality: {
|
|
21
|
+
greaterThanOrEqualTo: maxBase ? this.minBase.toNumber() : undefined,
|
|
22
|
+
notGreaterThanOrEqualTo: `^${Coinray.I18n.t("validation.notGreaterThanOrEqualTo", { min: correctNumberPrecision(this.precisionBase, this.minBase) })}`,
|
|
23
|
+
lessThanOrEqualTo: maxBase ? maxBase.toNumber() : undefined,
|
|
24
|
+
notLessThanOrEqualTo: `^${Coinray.I18n.t("validation.insufficientFunds")}`,
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
quoteAmount: {
|
|
28
|
+
bigNumericality: {
|
|
29
|
+
greaterThanOrEqualTo: maxQuote ? this.minQuote.toNumber() : undefined,
|
|
30
|
+
notGreaterThanOrEqualTo: `^${Coinray.I18n.t("validation.notGreaterThanOrEqualTo", { min: correctNumberPrecision(this.precisionQuote, this.minQuote) })}`,
|
|
31
|
+
lessThanOrEqualTo: maxQuote ? maxQuote.toNumber() : undefined,
|
|
32
|
+
notLessThanOrEqualTo: `^${Coinray.I18n.t("validation.insufficientFunds")}`,
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
this.updateQuoteAmount(params.quoteAmount);
|
|
38
|
+
this.updateBaseAmount(params.baseAmount);
|
|
39
|
+
}
|
|
40
|
+
updateBaseAmount(baseAmount) {
|
|
41
|
+
this.baseAmount = baseAmount;
|
|
42
|
+
this.validate();
|
|
43
|
+
}
|
|
44
|
+
updateQuoteAmount(quoteAmount) {
|
|
45
|
+
this.quoteAmount = quoteAmount;
|
|
46
|
+
this.validate();
|
|
47
|
+
}
|
|
48
|
+
getOrders() {
|
|
49
|
+
return [this];
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=market.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"market.js","sourceRoot":"","sources":["../../lib/orders/market.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,QAAQ,CAAC;AAC/B,OAAO,EAAC,YAAY,EAAmB,SAAS,EAAC,MAAM,UAAU,CAAC;AAElE,OAAO,OAAO,MAAM,YAAY,CAAC;AACjC,OAAO,EAAC,sBAAsB,EAAC,MAAM,SAAS,CAAC;AAQ/C,MAAM,CAAC,OAAO,OAAO,WAAY,SAAQ,SAAS;IAkChD,YAAY,MAAyB;QACnC,KAAK,CAAC,MAAM,CAAC,CAAC;QAhChB,cAAS,GAAG,SAAS,CAAC,MAAM,CAAC;QAE7B,gBAAW,GAAG,GAAG,EAAE;YACjB,IAAI,OAAO,GAAG,SAAS,CAAC;YACxB,IAAI,QAAQ,GAAG,SAAS,CAAC;YACzB,IAAI,IAAI,CAAC,YAAY,KAAK,YAAY,CAAC,KAAK,EAAE;gBAC5C,QAAQ,GAAG,IAAI,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAA;aACpC;iB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B,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;QAC3C,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;IAC3C,CAAC;IAED,gBAAgB,CAAC,UAAqB;QACpC,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,QAAQ,EAAE,CAAA;IACjB,CAAC;IAED,iBAAiB,CAAC,WAAsB;QACtC,IAAI,CAAC,WAAW,GAAG,WAAW,CAAC;QAC/B,IAAI,CAAC,QAAQ,EAAE,CAAA;IACjB,CAAC;IAED,SAAS;QACP,OAAO,CAAC,IAAI,CAAC,CAAA;IACf,CAAC;CACF"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { OrderType } from "../types";
|
|
2
|
+
import BigNumber from "bignumber.js";
|
|
3
|
+
import LimitOrder, { LimitOrderParams } from "./limit";
|
|
4
|
+
interface OcoOrderParams extends LimitOrderParams {
|
|
5
|
+
linkedOrderId: string;
|
|
6
|
+
otherPrice: BigNumber;
|
|
7
|
+
stopPrice: BigNumber;
|
|
8
|
+
}
|
|
9
|
+
export default class OcoOrder extends LimitOrder {
|
|
10
|
+
linkedOrderId: string;
|
|
11
|
+
otherPrice: BigNumber;
|
|
12
|
+
stopPrice: BigNumber;
|
|
13
|
+
orderType: OrderType;
|
|
14
|
+
constraints(): {
|
|
15
|
+
otherPrice: {
|
|
16
|
+
bigNumericality: {
|
|
17
|
+
greaterThan: number;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
stopPrice: {
|
|
21
|
+
bigNumericality: {
|
|
22
|
+
greaterThan: number;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
baseAmount: {
|
|
26
|
+
bigNumericality: {
|
|
27
|
+
greaterThanOrEqualTo: number;
|
|
28
|
+
notGreaterThanOrEqualTo: string;
|
|
29
|
+
lessThanOrEqualTo: any;
|
|
30
|
+
notLessThanOrEqualTo: string;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
quoteAmount: {
|
|
34
|
+
bigNumericality: {
|
|
35
|
+
greaterThanOrEqualTo: number;
|
|
36
|
+
notGreaterThanOrEqualTo: string;
|
|
37
|
+
lessThanOrEqualTo: any;
|
|
38
|
+
notLessThanOrEqualTo: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
price: {
|
|
42
|
+
bigNumericality: {
|
|
43
|
+
greaterThan: number;
|
|
44
|
+
};
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
constructor(params: OcoOrderParams);
|
|
48
|
+
updateQuoteAmount(quoteAmount: BigNumber): void;
|
|
49
|
+
updateBaseAmount(baseAmount: BigNumber): void;
|
|
50
|
+
updatePrice(price: BigNumber, priceOffset?: number): void;
|
|
51
|
+
updateOtherPrice(otherPrice: BigNumber, priceOffset?: number): void;
|
|
52
|
+
updateStopPrice(stopPrice: BigNumber, priceOffset?: number): void;
|
|
53
|
+
}
|
|
54
|
+
export {};
|