-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into feature/iqoption-candles
- Loading branch information
Showing
10 changed files
with
1,298 additions
and
1,132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { Hemes } from '@hemes/core' | ||
import { | ||
BaseIQOptionProvider, | ||
CandleInterval, | ||
IQOptionProvider, | ||
} from '@hemes/iqoption' | ||
import '../../loadEnv' | ||
|
||
async function run() { | ||
const hemes = new Hemes(IQOptionProvider).getProvider<BaseIQOptionProvider>() | ||
|
||
const account = await hemes.logIn({ | ||
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL), | ||
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD), | ||
}) | ||
|
||
const candles = await hemes.getCandles( | ||
6, | ||
CandleInterval['1S'], | ||
10, | ||
Date.now() | ||
) | ||
|
||
console.log('Account', !!account) | ||
console.log('\n', 'Candles', candles, '\n') | ||
} | ||
|
||
run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/iqoption/lib/websocket/events/requests/GetCandles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { Request } from '../Request' | ||
|
||
interface GetCandlesMessage { | ||
name: 'get-candles' | ||
version: '2.0' | ||
body: {} | ||
} | ||
|
||
interface GetCandlesRequestArgs { | ||
active_id: number | ||
interval: number | string | ||
endtime: number | ||
amount: number | ||
} | ||
|
||
export class GetCandlesRequest extends Request< | ||
GetCandlesMessage, | ||
GetCandlesRequestArgs | ||
> { | ||
public get name(): string { | ||
return 'sendMessage' | ||
} | ||
|
||
public async build({ | ||
active_id, | ||
interval, | ||
endtime, | ||
amount, | ||
}: GetCandlesRequestArgs): Promise<GetCandlesMessage> { | ||
return { | ||
name: 'get-candles', | ||
version: '2.0', | ||
body: { | ||
active_id: active_id, | ||
size: interval, | ||
to: endtime, | ||
count: amount, | ||
'': active_id, | ||
}, | ||
} | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
packages/iqoption/lib/websocket/events/responses/GetCandles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import { Candle } from 'packages/iqoption/lib/types' | ||
|
||
import { Response } from '../Response' | ||
|
||
export interface CandleResponseData { | ||
candles: Candle[] | ||
} | ||
|
||
export class GetCandlesResponse extends Response<CandleResponseData> { | ||
public get name(): string { | ||
return 'candles' | ||
} | ||
} |
Oops, something went wrong.