-
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.
feat: IQ Option package implementation
- Loading branch information
Showing
44 changed files
with
1,207 additions
and
278 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ typings/ | |
*.tgz | ||
|
||
# dotenv environment variable files | ||
.env* | ||
.env*.local | ||
|
||
# Library | ||
dist/ | ||
|
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"src/**/*.{js,ts,tsx}": [ | ||
"eslint --ext js,ts,tsx --fix" | ||
"packages/**/*.{js,ts}": [ | ||
"eslint --ext js,ts --fix" | ||
] | ||
} |
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,2 @@ | ||
TEST_IQOPTION_ACCOUNT_EMAIL= | ||
TEST_IQOPTION_ACCOUNT_PASSWORD= |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import '../../loadEnv' | ||
|
||
import { Hemes, sleep } from '@hemes/core' | ||
import { IQOptionProvider } from '@hemes/iqoption' | ||
|
||
async function run() { | ||
const hemes = new Hemes(IQOptionProvider).getProvider() | ||
|
||
const account = await hemes.logIn({ | ||
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL), | ||
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD), | ||
}) | ||
|
||
await sleep(5000) | ||
|
||
const profile = await account.getProfile() | ||
|
||
console.log('Has received profile ->', !!profile) | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import '../../loadEnv' | ||
|
||
import { Hemes } from '@hemes/core' | ||
import { IQOptionProvider } from '@hemes/iqoption' | ||
|
||
async function run() { | ||
const hemes = new Hemes(IQOptionProvider).getProvider() | ||
|
||
await hemes.logIn({ | ||
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL), | ||
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD), | ||
}) | ||
} | ||
|
||
run() |
Empty file.
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,21 @@ | ||
import '../../loadEnv' | ||
|
||
import { Hemes, sleep } from '@hemes/core' | ||
import { IQOptionProvider, BaseIQOptionProvider } from '@hemes/iqoption' | ||
|
||
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), | ||
}) | ||
|
||
await sleep(5000) | ||
|
||
const profile = await account.getProfile() | ||
|
||
console.log('Has received profile ->', !!profile) | ||
} | ||
|
||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import '../../loadEnv' | ||
|
||
import { Hemes } from '@hemes/core' | ||
import { BaseIQOptionProvider, IQOptionProvider } from '@hemes/iqoption' | ||
|
||
async function run() { | ||
const hemes = new Hemes(IQOptionProvider).getProvider<BaseIQOptionProvider>() | ||
|
||
await hemes.logIn({ | ||
email: String(process.env.TEST_IQOPTION_ACCOUNT_EMAIL), | ||
password: String(process.env.TEST_IQOPTION_ACCOUNT_PASSWORD), | ||
}) | ||
} | ||
|
||
run() |
Empty file.
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,8 @@ | ||
const dotenv = require('dotenv') | ||
const path = require('path') | ||
|
||
const envFileName = '.env.local' | ||
|
||
dotenv.config({ | ||
path: path.resolve(__dirname, envFileName), | ||
}) |
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,19 @@ | ||
{ | ||
"name": "@hemes/example", | ||
"version": "1.0.0", | ||
"license": "MIT", | ||
"scripts": { | ||
"update": "cd .. && yarn --force && yarn build && cd examples && yarn --force", | ||
"prestart": "yarn update", | ||
"start": "yarn ts-node" | ||
}, | ||
"dependencies": { | ||
"@hemes/core": "../packages/core", | ||
"@hemes/iqoption": "../packages/iqoption", | ||
"dotenv": "^8.2.0" | ||
}, | ||
"devDependencies": { | ||
"ts-node": "^9.1.1", | ||
"typescript": "^4.2.3" | ||
} | ||
} |
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,10 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"module": "commonjs", | ||
"strict": true, | ||
"esModuleInterop": true, | ||
"skipLibCheck": true, | ||
"forceConsistentCasingInFileNames": true | ||
} | ||
} |
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,114 @@ | ||
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. | ||
# yarn lockfile v1 | ||
|
||
|
||
"@hemes/core@../packages/core", "@hemes/core@0.0.1-next.0": | ||
version "0.0.1-next.0" | ||
|
||
"@hemes/iqoption@../packages/iqoption": | ||
version "0.0.1-next.0" | ||
dependencies: | ||
"@hemes/core" "0.0.1-next.0" | ||
axios "^0.21.1" | ||
md5 "2.3.0" | ||
|
||
arg@^4.1.0: | ||
version "4.1.3" | ||
resolved "https://registry.yarnpkg.com/arg/-/arg-4.1.3.tgz#269fc7ad5b8e42cb63c896d5666017261c144089" | ||
integrity sha512-58S9QDqG0Xx27YwPSt9fJxivjYl432YCwfDMfZ+71RAqUrZef7LrKQZ3LHLOwCS4FLNBplP533Zx895SeOCHvA== | ||
|
||
axios@^0.21.1: | ||
version "0.21.1" | ||
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8" | ||
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA== | ||
dependencies: | ||
follow-redirects "^1.10.0" | ||
|
||
buffer-from@^1.0.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.1.tgz#32713bc028f75c02fdb710d7c7bcec1f2c6070ef" | ||
integrity sha512-MQcXEUbCKtEo7bhqEs6560Hyd4XaovZlO/k9V3hjVUF/zwW7KBVdSK4gIt/bzwS9MbR5qob+F5jusZsb0YQK2A== | ||
|
||
charenc@0.0.2: | ||
version "0.0.2" | ||
resolved "https://registry.yarnpkg.com/charenc/-/charenc-0.0.2.tgz#c0a1d2f3a7092e03774bfa83f14c0fc5790a8667" | ||
integrity sha1-wKHS86cJLgN3S/qD8UwPxXkKhmc= | ||
|
||
create-require@^1.1.0: | ||
version "1.1.1" | ||
resolved "https://registry.yarnpkg.com/create-require/-/create-require-1.1.1.tgz#c1d7e8f1e5f6cfc9ff65f9cd352d37348756c333" | ||
integrity sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ== | ||
|
||
crypt@0.0.2: | ||
version "0.0.2" | ||
resolved "https://registry.yarnpkg.com/crypt/-/crypt-0.0.2.tgz#88d7ff7ec0dfb86f713dc87bbb42d044d3e6c41b" | ||
integrity sha1-iNf/fsDfuG9xPch7u0LQRNPmxBs= | ||
|
||
diff@^4.0.1: | ||
version "4.0.2" | ||
resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" | ||
integrity sha512-58lmxKSA4BNyLz+HHMUzlOEpg09FV+ev6ZMe3vJihgdxzgcwZ8VoEEPmALCZG9LmqfVoNMMKpttIYTVG6uDY7A== | ||
|
||
dotenv@^8.2.0: | ||
version "8.2.0" | ||
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a" | ||
integrity sha512-8sJ78ElpbDJBHNeBzUbUVLsqKdccaa/BXF1uPTw3GrvQTBgrQrtObr2mUrE38vzYd8cEv+m/JBfDLioYcfXoaw== | ||
|
||
follow-redirects@^1.10.0: | ||
version "1.13.3" | ||
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.13.3.tgz#e5598ad50174c1bc4e872301e82ac2cd97f90267" | ||
integrity sha512-DUgl6+HDzB0iEptNQEXLx/KhTmDb8tZUHSeLqpnjpknR70H0nC2t9N73BK6fN4hOvJ84pKlIQVQ4k5FFlBedKA== | ||
|
||
is-buffer@~1.1.6: | ||
version "1.1.6" | ||
resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" | ||
integrity sha512-NcdALwpXkTm5Zvvbk7owOUSvVvBKDgKP5/ewfXEznmQFfs4ZRmanOeKBTjRVjka3QFoN6XJ+9F3USqfHqTaU5w== | ||
|
||
make-error@^1.1.1: | ||
version "1.3.6" | ||
resolved "https://registry.yarnpkg.com/make-error/-/make-error-1.3.6.tgz#2eb2e37ea9b67c4891f684a1394799af484cf7a2" | ||
integrity sha512-s8UhlNe7vPKomQhC1qFelMokr/Sc3AgNbso3n74mVPA5LTZwkB9NlXf4XPamLxJE8h0gh73rM94xvwRT2CVInw== | ||
|
||
md5@2.3.0: | ||
version "2.3.0" | ||
resolved "https://registry.yarnpkg.com/md5/-/md5-2.3.0.tgz#c3da9a6aae3a30b46b7b0c349b87b110dc3bda4f" | ||
integrity sha512-T1GITYmFaKuO91vxyoQMFETst+O71VUPEU3ze5GNzDm0OWdP8v1ziTaAEPUr/3kLsY3Sftgz242A1SetQiDL7g== | ||
dependencies: | ||
charenc "0.0.2" | ||
crypt "0.0.2" | ||
is-buffer "~1.1.6" | ||
|
||
source-map-support@^0.5.17: | ||
version "0.5.19" | ||
resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" | ||
integrity sha512-Wonm7zOCIJzBGQdB+thsPar0kYuCIzYvxZwlBa87yi/Mdjv7Tip2cyVbLj5o0cFPN4EVkuTwb3GDDyUx2DGnGw== | ||
dependencies: | ||
buffer-from "^1.0.0" | ||
source-map "^0.6.0" | ||
|
||
source-map@^0.6.0: | ||
version "0.6.1" | ||
resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" | ||
integrity sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g== | ||
|
||
ts-node@^9.1.1: | ||
version "9.1.1" | ||
resolved "https://registry.yarnpkg.com/ts-node/-/ts-node-9.1.1.tgz#51a9a450a3e959401bda5f004a72d54b936d376d" | ||
integrity sha512-hPlt7ZACERQGf03M253ytLY3dHbGNGrAq9qIHWUY9XHYl1z7wYngSr3OQ5xmui8o2AaxsONxIzjafLUiWBo1Fg== | ||
dependencies: | ||
arg "^4.1.0" | ||
create-require "^1.1.0" | ||
diff "^4.0.1" | ||
make-error "^1.1.1" | ||
source-map-support "^0.5.17" | ||
yn "3.1.1" | ||
|
||
typescript@^4.2.3: | ||
version "4.2.3" | ||
resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.2.3.tgz#39062d8019912d43726298f09493d598048c1ce3" | ||
integrity sha512-qOcYwxaByStAWrBf4x0fibwZvMRG+r4cQoTjbPtUlrWjBHbmCAww1i448U0GJ+3cNNEtebDteo/cHOR3xJ4wEw== | ||
|
||
yn@3.1.1: | ||
version "3.1.1" | ||
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50" | ||
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q== |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
const { join } = require('path') | ||
const path = require('path') | ||
|
||
const baseConfig = require('../../jest.config') | ||
const pkg = require('./package.json') | ||
|
||
delete baseConfig.projects | ||
|
||
const testsPath = path.join(__dirname, '__tests__') | ||
|
||
module.exports = { | ||
...baseConfig, | ||
displayName: pkg.name, | ||
testMatch: [join(__dirname, '__tests__/**/*.spec.{ts,tsx}')], | ||
testMatch: [path.join(testsPath, '**/*.spec.{ts,tsx}')], | ||
} |
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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
import { ProviderConstructor, BaseHemes, Provider } from './types' | ||
import { BaseHemes, ClassPrototype, ProviderConstructor } from './types' | ||
|
||
export class Hemes<PC extends ProviderConstructor> implements BaseHemes { | ||
private HemesProvider: PC | ||
export class Hemes<T extends ClassPrototype> implements BaseHemes<T> { | ||
private provider: any | ||
|
||
constructor(provider: PC) { | ||
this.HemesProvider = provider | ||
constructor(HemesProvider: T & ProviderConstructor<T>) { | ||
this.provider = new HemesProvider(this) | ||
} | ||
|
||
getProvider(): Provider { | ||
return new this.HemesProvider(this) | ||
public getProvider<P = T['prototype']>(): P { | ||
return this.provider | ||
} | ||
} |
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 |
---|---|---|
|
@@ -3,6 +3,11 @@ | |
*/ | ||
export * from './Hemes' | ||
|
||
/** | ||
* Utils | ||
*/ | ||
export * from './utils/sleep' | ||
|
||
/** | ||
* Types | ||
*/ | ||
|
Oops, something went wrong.