2017-09-25 02:06:28 +00:00
|
|
|
import { BTCTxExplorer, ETHTxExplorer } from './data';
|
2017-09-05 20:07:28 +00:00
|
|
|
|
2017-12-19 22:46:34 +00:00
|
|
|
export type WhitelistedCoins = 'BTC' | 'REP' | 'ETH';
|
2017-09-05 20:07:28 +00:00
|
|
|
const serverURL = 'https://bity.myetherapi.com';
|
|
|
|
const bityURL = 'https://bity.com/api';
|
|
|
|
const BTCMin = 0.01;
|
|
|
|
const BTCMax = 3;
|
|
|
|
|
|
|
|
// while Bity is supposedly OK with any order that is at least 0.01 BTC Worth, the order will fail if you send 0.01 BTC worth of ETH.
|
|
|
|
// This is a bad magic number, but will suffice for now
|
|
|
|
// value = percent higher/lower than 0.01 BTC worth
|
|
|
|
const buffers = {
|
|
|
|
ETH: 0.1,
|
|
|
|
REP: 0.2
|
|
|
|
};
|
|
|
|
|
|
|
|
// rate must be BTC[KIND]
|
2017-12-19 22:46:34 +00:00
|
|
|
export function generateKindMin(BTCKINDRate: number, kind: keyof typeof buffers): number {
|
2017-09-25 02:06:28 +00:00
|
|
|
const kindMinVal = BTCKINDRate * BTCMin;
|
|
|
|
return kindMinVal + kindMinVal * buffers[kind];
|
2017-09-05 20:07:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// rate must be BTC[KIND]
|
2017-12-19 22:46:34 +00:00
|
|
|
export function generateKindMax(BTCKINDRate: number, kind: keyof typeof buffers): number {
|
2017-09-05 20:07:28 +00:00
|
|
|
const kindMax = BTCKINDRate * BTCMax;
|
|
|
|
return kindMax - kindMax * buffers[kind];
|
|
|
|
}
|
|
|
|
|
|
|
|
const info = {
|
|
|
|
serverURL,
|
|
|
|
bityURL,
|
|
|
|
ETHTxExplorer,
|
|
|
|
BTCTxExplorer,
|
|
|
|
BTCMin,
|
|
|
|
BTCMax,
|
2017-06-19 05:39:07 +00:00
|
|
|
validStatus: ['RCVE', 'FILL', 'CONF', 'EXEC'],
|
|
|
|
invalidStatus: ['CANC'],
|
|
|
|
postConfig: {
|
|
|
|
headers: {
|
2017-07-31 23:14:30 +00:00
|
|
|
'Content-Type': 'application/json; charset:UTF-8'
|
2017-06-19 00:56:11 +00:00
|
|
|
}
|
2017-06-19 05:39:07 +00:00
|
|
|
}
|
|
|
|
};
|
2017-09-05 20:07:28 +00:00
|
|
|
|
|
|
|
export default info;
|