Skip to content

Commit 18dea83

Browse files
committed
changes after merge peterszombati#26
1 parent 638b74a commit 18dea83

29 files changed

+97
-119
lines changed

package.json

Lines changed: 17 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -13,31 +13,31 @@
1313
"build/*"
1414
],
1515
"dependencies": {
16-
"logger4": "^2.1.5",
17-
"ws": "^8.9.0"
16+
"logger4": "2.1.5",
17+
"ws": "8.9.0"
1818
},
1919
"devDependencies": {
20-
"@types/chai": "^4.3.3",
21-
"@types/mocha": "^10.0.0",
22-
"@types/node": "^18.7.23",
23-
"@types/ws": "^8.5.3",
24-
"@typescript-eslint/eslint-plugin": "^5.38.1",
25-
"@typescript-eslint/parser": "^5.38.1",
26-
"chai": "^4.3.6",
27-
"esbuild": "^0.15.10",
28-
"eslint": "^8.24.0",
29-
"mocha": "^10.0.0",
30-
"prettier": "^2.7.1",
31-
"ts-mocha": "^10.0.0",
32-
"ts-node": "^10.9.1",
33-
"typescript": "^4.8.4"
20+
"@types/chai": "4.3.3",
21+
"@types/mocha": "10.0.0",
22+
"@types/node": "18.7.23",
23+
"@types/ws": "8.5.3",
24+
"@typescript-eslint/eslint-plugin": "5.38.1",
25+
"@typescript-eslint/parser": "5.38.1",
26+
"chai": "4.3.6",
27+
"esbuild": "0.15.10",
28+
"eslint": "8.24.0",
29+
"mocha": "10.0.0",
30+
"prettier": "2.7.1",
31+
"ts-mocha": "10.0.0",
32+
"ts-node": "10.9.1",
33+
"typescript": "4.8.4"
3434
},
3535
"scripts": {
3636
"build": "rm -rf ./build && tsc --declaration --emitDeclarationOnly & node ./esbuild.config.js",
3737
"test": "ts-mocha -p ./tsconfig.json ./sandbox/tests.ts ./sandbox/sandbox.ts --exit",
3838
"prettier": "prettier --check \"src/**/*.ts\" \"sandbox/**/*.ts\"",
3939
"eslint": "eslint --fix \"src/**/*.ts\" \"sandbox/**/*.ts\"",
40-
"lint": "tsc --noEmit && pnpm run prettier && pnpm run eslint"
40+
"lint": "tsc --noEmit && npm run prettier && npm run eslint"
4141
},
4242
"repository": {
4343
"type": "git",
@@ -58,48 +58,4 @@
5858
"url": "https://github.com/peterszombati/xapi-node/issues"
5959
},
6060
"homepage": "https://github.com/peterszombati/xapi-node#readme"
61-
=======
62-
"name": "xapi-node",
63-
"version": "2.5.6",
64-
"description": "This project is made possible to get data from Forex market, execute market or limit order with NodeJS/JS through WebSocket connection",
65-
"main": "build/index.js",
66-
"types": "build/index.d.ts",
67-
"dependencies": {
68-
"logger4": "^2.1.5",
69-
"ws": "^7.2.3"
70-
},
71-
"devDependencies": {
72-
"@types/node": "^11.15.3",
73-
"typescript": "^3.4.5",
74-
"ts-mocha": "^8.0.0",
75-
"@types/chai": "^4.2.14",
76-
"@types/mocha": "^8.0.3",
77-
"chai": "^4.2.0",
78-
"mocha": "^8.2.0",
79-
"ts-node": "^9.0.0"
80-
},
81-
"scripts": {
82-
"test": "echo \"Error: no test specified\" && exit 1",
83-
"build": "tsc"
84-
},
85-
"repository": {
86-
"type": "git",
87-
"url": "git+https://github.com/peterszombati/xapi-node.git"
88-
},
89-
"keywords": [
90-
"xstation5",
91-
"trading",
92-
"xtb",
93-
"bfbcapital",
94-
"forex",
95-
"trading-api",
96-
"xopenhub"
97-
],
98-
"prepare": "npm run build",
99-
"author": "Peter Szombati",
100-
"license": "BSD 4-Clause",
101-
"bugs": {
102-
"url": "https://github.com/peterszombati/xapi-node/issues"
103-
},
104-
"homepage": "https://github.com/peterszombati/xapi-node#readme"
10561
}

sandbox/parseLoginFile.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ export function parseLoginFile(loginJsonFile: string): XAPIConfig {
66
throw `${loginJsonFile} is not exists.`
77
}
88
return parseJsonLogin(fs.readFileSync(loginJsonFile).toString())
9-
}
9+
}

sandbox/sandbox.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,4 +42,4 @@ describe('sandbox', () => {
4242

4343
return await new Promise<void>(resolve => resolve())
4444
})
45-
})
45+
})

sandbox/test/connectionTest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/* sensitive/sensitive.json
2-
{
3-
"accountId": "",
4-
"password": "",
5-
"type": "real"
6-
}
7-
*/
8-
91
import { XAPI } from '../../src/core/XAPI'
102
import { ConnectionStatus } from '../../src'
113

sandbox/test/getCandlesTest.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import { XAPI } from '../../src/core/XAPI'
2+
import { ConnectionStatus } from '../../src'
3+
4+
export function getCandlesTest(x: XAPI): Promise<void> {
5+
return new Promise((resolve, reject) => {
6+
try {
7+
x.Stream.listen.getCandles((data => {
8+
resolve()
9+
}))
10+
x.onReady(() => {
11+
console.log('Connection is ready')
12+
x.Stream.subscribe.getCandles('EURUSD')
13+
})
14+
x.onConnectionChange(status => {
15+
console.log(ConnectionStatus[status])
16+
})
17+
} catch (e) {
18+
reject(e)
19+
}
20+
})
21+
}

sandbox/test/messageQueuStressTest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/* sensitive/sensitive.json
2-
{
3-
"accountId": "",
4-
"password": "",
5-
"type": "real"
6-
}
7-
*/
8-
91
import { XAPI } from '../../src/core/XAPI'
102
import { Time } from '../../src'
113

sandbox/test/subscribeTest.ts

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
/* sensitive/sensitive.json
2-
{
3-
"accountId": "",
4-
"password": "",
5-
"type": "real"
6-
}
7-
*/
8-
91
import { XAPI } from '../../src/core/XAPI'
102
import { ConnectionStatus } from '../../src'
113

sandbox/tests.ts

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,16 @@ import { tradeTest } from './test/tradeTest'
66
import { connectionTest } from './test/connectionTest'
77
import { messageQueuStressTest } from './test/messageQueuStressTest'
88
import { subscribeTest } from './test/subscribeTest'
9+
import { getCandlesTest } from './test/getCandlesTest'
910

1011
const jsonPath = path.join(process.cwd(), 'sensitive', 'sensitive-demo-login.json')
12+
/* sensitive/sensitive-demo-login.json
13+
{
14+
"accountId": "",
15+
"password": "",
16+
"type": "real"
17+
}
18+
*/
1119

1220
async function init(): Promise<XAPI> {
1321
const login = parseLoginFile(jsonPath)
@@ -29,6 +37,14 @@ describe('tests', () => {
2937
x.disconnect()
3038
})
3139

40+
it('candleTest', async function () {
41+
this.timeout(8000)
42+
const x = await init()
43+
await getCandlesTest(x)
44+
x.disconnect()
45+
})
46+
47+
3248
it('subscribeTest', async function () {
3349
this.timeout(8000)
3450
const x = await init()
@@ -42,4 +58,4 @@ describe('tests', () => {
4258
await tradeTest(x)
4359
x.disconnect()
4460
})
45-
})
61+
})

src/core/OpenPosition.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ export class OpenPosition extends TradeRecord {
3131
customComment: params.customComment || undefined,
3232
})
3333
}
34-
}
34+
}

src/core/PendingOrder.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@ export class PendingOrder extends TradeRecord {
3030
customComment: params.customComment,
3131
})
3232
}
33-
}
33+
}

0 commit comments

Comments
 (0)