-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathbot-setup.ts
69 lines (62 loc) · 3.08 KB
/
bot-setup.ts
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
// This file automates logging into Autoview, useful if you have a lot of exchanges.
// You can add additional exchanges here by duplicating lines 18-38 and modifying as needed
let krakenPrivateKey = ''; // enter your Kraken private key here
let krakenPublicKey = ''; // enter your Kraken public key here
let bitfinexPrivateKey = ''; // enter your Bitfinex private key here
let bitfinexPublicKey = ''; // enter your Bitfinex public key here
import { Chromeless } from 'chromeless';
module.exports = {
autoViewSetup: async function () {
const chromeless = new Chromeless({
launchChrome: true,
waitTimeout: 20000
});
// Kraken Setup
await chromeless
.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3430.0 Safari/537.36')
// .setViewport({width: 2485, height: 1400, scale: 1})
.goto('chrome-extension://okdhadoplaoehmeldlpakhpekjcpljmb/options.html')
.wait(2000)
.click('[data-page="settings"]')
.wait(200)
.click('button[name="grant"][data-exchange="KRAKEN"]')
.wait(2000)
.click('[data-page="exchange-kraken"]')
.wait(200)
.type(krakenPrivateKey, '#exchange-kraken-private-0') // private key
.type(krakenPublicKey, '#exchange-kraken-public-0') // public key
.click('button[name="test"][data-exchange="KRAKEN"]')
.wait(200)
.click('button[data-action="action_access_save"][data-exchange="KRAKEN"]')
.wait(5000)
.catch((err) => {
console.error(err);
});
console.log('Finished Enabling 1 Exchange! (Kraken)'); // prints local file path or S3 url
// Bitfinex Setup
await chromeless
.setUserAgent('Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3430.0 Safari/537.36')
// .setViewport({width: 2485, height: 1400, scale: 1})
.goto('chrome-extension://okdhadoplaoehmeldlpakhpekjcpljmb/options.html')
.wait(2000)
.click('[data-page="settings"]')
.wait(200)
.click('button[name="grant"][data-exchange="BITFINEX"]')
.wait(2000)
.click('[data-page="exchange-bitfinex"]')
.wait(200)
.type(bitfinexPrivateKey, '#exchange-bitfinex-private-0') // private key
.type(bitfinexPublicKey, '#exchange-bitfinex-public-0') // public key
.click('button[name="test"][data-exchange="BITFINEX"]')
.wait(200)
.click('button[data-action="action_access_save"][data-exchange="BITFINEX"]')
.wait(5000)
.catch((err) => {
console.error(err);
});
console.log('Finished Enabling 1 Exchange! (Bitfinex)'); // prints local file path or S3 url
await chromeless.end();
}
}
// Make this runnable from package.json through NPM scripts using `make-runnable`
require('make-runnable'); // must be at the END of the file