forked from tiagosiebler/TriangularArbitrage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
62 lines (52 loc) · 1.44 KB
/
index.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
// Load logger library
const logger = require('./lib/LoggerCore');
const Web3 = require('web3');
var env = require('node-env-file');
try {
env(__dirname + '/.keys');
} catch (e) {
console.warn('No .keys was provided, running with defaults.');
}
env(__dirname + '/conf.ini');
const web3 = new Web3('https://rpc-mainnet.maticvigil.com');
logger.info('\n\n\n----- Bot Starting : -----\n\n\n');
var exchangeAPI = {};
logger.info('--- Loading Exchange API');
// TODO: Add Uniswap/Polygon logic here
// const uniswap = new Uniswap(web3); // Placeholder, actual Uniswap API initialization may differ
var botOptions = {
UI: {
title: 'Top Potential Arbitrage Triplets, via Uniswap on Polygon'
},
arbitrage: {
paths: process.env.uniswapColumns.split(','),
start: process.env.uniswapStartingPoint
},
storage: {
logHistory: false
},
trading: {
paperOnly: true,
minQueuePercentageThreshold: 3,
minHitsThreshold: 5
}
},
ctrl = {
options: botOptions,
storage: {
trading: {
queue: [],
active: []
},
candidates: [],
streams: [],
pairRanks: []
},
logger: logger,
exchange: exchangeAPI // This will hold your Uniswap/Polygon API later
};
ctrl.UI = require('./lib/UI')(ctrl.options),
ctrl.events = require('./lib/EventsCore')(ctrl);
// We're ready to start. Load up the webhook streams and start making it rain.
require('./lib/BotCore')(ctrl);
ctrl.logger.info('----- Bot Startup Finished -----');