@himalaya-quant/ctrader-x 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env +6 -0
- package/.prettierrc +7 -0
- package/README.md +96 -0
- package/changelog.md +46 -0
- package/dist/src/classes/client.d.ts +21 -0
- package/dist/src/classes/client.d.ts.map +1 -0
- package/dist/src/classes/client.js +83 -0
- package/dist/src/classes/client.js.map +1 -0
- package/dist/src/classes/client.test.d.ts +2 -0
- package/dist/src/classes/client.test.d.ts.map +1 -0
- package/dist/src/classes/client.test.js +83 -0
- package/dist/src/classes/client.test.js.map +1 -0
- package/dist/src/classes/errors/client-not-connected.error.d.ts +5 -0
- package/dist/src/classes/errors/client-not-connected.error.d.ts.map +1 -0
- package/dist/src/classes/errors/client-not-connected.error.js +11 -0
- package/dist/src/classes/errors/client-not-connected.error.js.map +1 -0
- package/dist/src/classes/errors/connection.error.d.ts +5 -0
- package/dist/src/classes/errors/connection.error.d.ts.map +1 -0
- package/dist/src/classes/errors/connection.error.js +11 -0
- package/dist/src/classes/errors/connection.error.js.map +1 -0
- package/dist/src/classes/logger.d.ts +13 -0
- package/dist/src/classes/logger.d.ts.map +1 -0
- package/dist/src/classes/logger.js +21 -0
- package/dist/src/classes/logger.js.map +1 -0
- package/dist/src/classes/managers/authentication/authentication.manager.d.ts +13 -0
- package/dist/src/classes/managers/authentication/authentication.manager.d.ts.map +1 -0
- package/dist/src/classes/managers/authentication/authentication.manager.js +49 -0
- package/dist/src/classes/managers/authentication/authentication.manager.js.map +1 -0
- package/dist/src/classes/managers/authentication/authentication.manager.test.d.ts +2 -0
- package/dist/src/classes/managers/authentication/authentication.manager.test.d.ts.map +1 -0
- package/dist/src/classes/managers/authentication/authentication.manager.test.js +114 -0
- package/dist/src/classes/managers/authentication/authentication.manager.test.js.map +1 -0
- package/dist/src/classes/managers/authentication/errors/application-auth.error.d.ts +5 -0
- package/dist/src/classes/managers/authentication/errors/application-auth.error.d.ts.map +1 -0
- package/dist/src/classes/managers/authentication/errors/application-auth.error.js +11 -0
- package/dist/src/classes/managers/authentication/errors/application-auth.error.js.map +1 -0
- package/dist/src/classes/managers/authentication/errors/user-auth.error.d.ts +5 -0
- package/dist/src/classes/managers/authentication/errors/user-auth.error.d.ts.map +1 -0
- package/dist/src/classes/managers/authentication/errors/user-auth.error.js +11 -0
- package/dist/src/classes/managers/authentication/errors/user-auth.error.js.map +1 -0
- package/dist/src/classes/managers/models/base.manager.d.ts +15 -0
- package/dist/src/classes/managers/models/base.manager.d.ts.map +1 -0
- package/dist/src/classes/managers/models/base.manager.js +35 -0
- package/dist/src/classes/managers/models/base.manager.js.map +1 -0
- package/dist/src/classes/managers/models/credentials.model.d.ts +8 -0
- package/dist/src/classes/managers/models/credentials.model.d.ts.map +1 -0
- package/dist/src/classes/managers/models/credentials.model.js +3 -0
- package/dist/src/classes/managers/models/credentials.model.js.map +1 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-details.error.d.ts +5 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-details.error.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-details.error.js +11 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-details.error.js.map +1 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-list.error.d.ts +5 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-list.error.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-list.error.js +11 -0
- package/dist/src/classes/managers/symbols/errors/get-symbols-list.error.js.map +1 -0
- package/dist/src/classes/managers/symbols/errors/get-trend-bars.error.d.ts +6 -0
- package/dist/src/classes/managers/symbols/errors/get-trend-bars.error.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/errors/get-trend-bars.error.js +13 -0
- package/dist/src/classes/managers/symbols/errors/get-trend-bars.error.js.map +1 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-live-trend-bars.error.d.ts +8 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-live-trend-bars.error.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-live-trend-bars.error.js +17 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-live-trend-bars.error.js.map +1 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-spot-events.error.d.ts +5 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-spot-events.error.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-spot-events.error.js +11 -0
- package/dist/src/classes/managers/symbols/errors/subscribe-spot-events.error.js.map +1 -0
- package/dist/src/classes/managers/symbols/errors/unsubscribe-live-trend-bars.error.d.ts +5 -0
- package/dist/src/classes/managers/symbols/errors/unsubscribe-live-trend-bars.error.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/errors/unsubscribe-live-trend-bars.error.js +11 -0
- package/dist/src/classes/managers/symbols/errors/unsubscribe-live-trend-bars.error.js.map +1 -0
- package/dist/src/classes/managers/symbols/symbols-updates.manager.d.ts +54 -0
- package/dist/src/classes/managers/symbols/symbols-updates.manager.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/symbols-updates.manager.js +250 -0
- package/dist/src/classes/managers/symbols/symbols-updates.manager.js.map +1 -0
- package/dist/src/classes/managers/symbols/symbols.manager.d.ts +30 -0
- package/dist/src/classes/managers/symbols/symbols.manager.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/symbols.manager.js +78 -0
- package/dist/src/classes/managers/symbols/symbols.manager.js.map +1 -0
- package/dist/src/classes/managers/symbols/symbols.manager.test.d.ts +2 -0
- package/dist/src/classes/managers/symbols/symbols.manager.test.d.ts.map +1 -0
- package/dist/src/classes/managers/symbols/symbols.manager.test.js +364 -0
- package/dist/src/classes/managers/symbols/symbols.manager.test.js.map +1 -0
- package/dist/src/classes/models/client-configuration.model.d.ts +10 -0
- package/dist/src/classes/models/client-configuration.model.d.ts.map +1 -0
- package/dist/src/classes/models/client-configuration.model.js +3 -0
- package/dist/src/classes/models/client-configuration.model.js.map +1 -0
- package/dist/src/classes/models/ctrader-x-error.model.d.ts +6 -0
- package/dist/src/classes/models/ctrader-x-error.model.d.ts.map +1 -0
- package/dist/src/classes/models/ctrader-x-error.model.js +21 -0
- package/dist/src/classes/models/ctrader-x-error.model.js.map +1 -0
- package/dist/src/config/config.d.ts +10 -0
- package/dist/src/config/config.d.ts.map +1 -0
- package/dist/src/config/config.js +40 -0
- package/dist/src/config/config.js.map +1 -0
- package/dist/src/examples/authentication.example.d.ts +2 -0
- package/dist/src/examples/authentication.example.d.ts.map +1 -0
- package/dist/src/examples/authentication.example.js +9 -0
- package/dist/src/examples/authentication.example.js.map +1 -0
- package/dist/src/examples/get-symbols-bars.example.d.ts +2 -0
- package/dist/src/examples/get-symbols-bars.example.d.ts.map +1 -0
- package/dist/src/examples/get-symbols-bars.example.js +18 -0
- package/dist/src/examples/get-symbols-bars.example.js.map +1 -0
- package/dist/src/examples/get-symbols-list.example.d.ts +2 -0
- package/dist/src/examples/get-symbols-list.example.d.ts.map +1 -0
- package/dist/src/examples/get-symbols-list.example.js +13 -0
- package/dist/src/examples/get-symbols-list.example.js.map +1 -0
- package/dist/src/examples/subscribe-live-bars.example.d.ts +2 -0
- package/dist/src/examples/subscribe-live-bars.example.d.ts.map +1 -0
- package/dist/src/examples/subscribe-live-bars.example.js +42 -0
- package/dist/src/examples/subscribe-live-bars.example.js.map +1 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +20 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/models/common/ohlcv.d.ts +10 -0
- package/dist/src/models/common/ohlcv.d.ts.map +1 -0
- package/dist/src/models/common/ohlcv.js +13 -0
- package/dist/src/models/common/ohlcv.js.map +1 -0
- package/dist/src/models/proto/base-proto.d.ts +5 -0
- package/dist/src/models/proto/base-proto.d.ts.map +1 -0
- package/dist/src/models/proto/base-proto.js +9 -0
- package/dist/src/models/proto/base-proto.js.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthReq.d.ts +5 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthReq.js +9 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthReq.js.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthRes.d.ts +4 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthRes.js +8 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAAccountAuthRes.js.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthReq.d.ts +6 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthReq.js +10 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthReq.js.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthRes.d.ts +4 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthRes.js +8 -0
- package/dist/src/models/proto/messages/authentication/ProtoOAApplicationAuthRes.js.map +1 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsReq.d.ts +6 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsReq.js +10 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsReq.js.map +1 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsRes.d.ts +4 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsRes.js +8 -0
- package/dist/src/models/proto/messages/common/ProtoOASubscribeSpotsRes.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsReq.d.ts +10 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsReq.js +13 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsReq.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsRes.d.ts +11 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsRes.js +13 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAGetTrendbarsRes.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarReq.d.ts +7 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarReq.js +10 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarReq.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarRes.d.ts +4 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarRes.js +8 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarRes.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdReq.d.ts +5 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdReq.js +9 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdReq.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdRes.d.ts +8 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdRes.js +10 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolByIdRes.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListReq.d.ts +5 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListReq.js +9 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListReq.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListRes.d.ts +7 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListRes.js +10 -0
- package/dist/src/models/proto/messages/symbols/ProtoOASymbolsListRes.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarReq.d.ts +7 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarReq.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarReq.js +10 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarReq.js.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarRes.d.ts +4 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarRes.d.ts.map +1 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarRes.js +8 -0
- package/dist/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarRes.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOAArchivedSymbol.d.ts +7 -0
- package/dist/src/models/proto/models/ProtoOAArchivedSymbol.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOAArchivedSymbol.js +11 -0
- package/dist/src/models/proto/models/ProtoOAArchivedSymbol.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOAErrorRes.d.ts +8 -0
- package/dist/src/models/proto/models/ProtoOAErrorRes.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOAErrorRes.js +12 -0
- package/dist/src/models/proto/models/ProtoOAErrorRes.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOAHoliday.d.ts +9 -0
- package/dist/src/models/proto/models/ProtoOAHoliday.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOAHoliday.js +13 -0
- package/dist/src/models/proto/models/ProtoOAHoliday.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOAInterval.d.ts +6 -0
- package/dist/src/models/proto/models/ProtoOAInterval.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOAInterval.js +10 -0
- package/dist/src/models/proto/models/ProtoOAInterval.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOALightSymbol.d.ts +11 -0
- package/dist/src/models/proto/models/ProtoOALightSymbol.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOALightSymbol.js +15 -0
- package/dist/src/models/proto/models/ProtoOALightSymbol.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOASpotEvent.d.ts +11 -0
- package/dist/src/models/proto/models/ProtoOASpotEvent.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOASpotEvent.js +14 -0
- package/dist/src/models/proto/models/ProtoOASpotEvent.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOASymbol.d.ts +44 -0
- package/dist/src/models/proto/models/ProtoOASymbol.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOASymbol.js +46 -0
- package/dist/src/models/proto/models/ProtoOASymbol.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOATrendbar.d.ts +11 -0
- package/dist/src/models/proto/models/ProtoOATrendbar.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOATrendbar.js +14 -0
- package/dist/src/models/proto/models/ProtoOATrendbar.js.map +1 -0
- package/dist/src/models/proto/models/ProtoOATrendbarPeriod.d.ts +17 -0
- package/dist/src/models/proto/models/ProtoOATrendbarPeriod.d.ts.map +1 -0
- package/dist/src/models/proto/models/ProtoOATrendbarPeriod.js +21 -0
- package/dist/src/models/proto/models/ProtoOATrendbarPeriod.js.map +1 -0
- package/dist/src/models/proto/payload-types/payload-types.enum.d.ts +78 -0
- package/dist/src/models/proto/payload-types/payload-types.enum.d.ts.map +1 -0
- package/dist/src/models/proto/payload-types/payload-types.enum.js +82 -0
- package/dist/src/models/proto/payload-types/payload-types.enum.js.map +1 -0
- package/dist/src/utils/price.utils.d.ts +4 -0
- package/dist/src/utils/price.utils.d.ts.map +1 -0
- package/dist/src/utils/price.utils.js +36 -0
- package/dist/src/utils/price.utils.js.map +1 -0
- package/dist/src/utils/sleep.utils.d.ts +5 -0
- package/dist/src/utils/sleep.utils.d.ts.map +1 -0
- package/dist/src/utils/sleep.utils.js +15 -0
- package/dist/src/utils/sleep.utils.js.map +1 -0
- package/dist/src/utils/timeframe.utils.d.ts +6 -0
- package/dist/src/utils/timeframe.utils.d.ts.map +1 -0
- package/dist/src/utils/timeframe.utils.js +47 -0
- package/dist/src/utils/timeframe.utils.js.map +1 -0
- package/dist/src/utils/trendbar.utils.d.ts +7 -0
- package/dist/src/utils/trendbar.utils.d.ts.map +1 -0
- package/dist/src/utils/trendbar.utils.js +28 -0
- package/dist/src/utils/trendbar.utils.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vitest.config.d.ts +3 -0
- package/dist/vitest.config.d.ts.map +1 -0
- package/dist/vitest.config.js +12 -0
- package/dist/vitest.config.js.map +1 -0
- package/package.json +48 -0
- package/src/classes/client.test.ts +100 -0
- package/src/classes/client.ts +102 -0
- package/src/classes/errors/client-not-connected.error.ts +7 -0
- package/src/classes/errors/connection.error.ts +7 -0
- package/src/classes/logger.ts +26 -0
- package/src/classes/managers/authentication/authentication.manager.test.ts +187 -0
- package/src/classes/managers/authentication/authentication.manager.ts +65 -0
- package/src/classes/managers/authentication/errors/application-auth.error.ts +9 -0
- package/src/classes/managers/authentication/errors/user-auth.error.ts +9 -0
- package/src/classes/managers/models/base.manager.ts +50 -0
- package/src/classes/managers/models/credentials.model.ts +15 -0
- package/src/classes/managers/symbols/errors/get-symbols-details.error.ts +9 -0
- package/src/classes/managers/symbols/errors/get-symbols-list.error.ts +9 -0
- package/src/classes/managers/symbols/errors/get-trend-bars.error.ts +7 -0
- package/src/classes/managers/symbols/errors/subscribe-live-trend-bars.error.ts +17 -0
- package/src/classes/managers/symbols/errors/subscribe-spot-events.error.ts +9 -0
- package/src/classes/managers/symbols/errors/unsubscribe-live-trend-bars.error.ts +9 -0
- package/src/classes/managers/symbols/symbols-updates.manager.ts +440 -0
- package/src/classes/managers/symbols/symbols.manager.test.ts +455 -0
- package/src/classes/managers/symbols/symbols.manager.ts +134 -0
- package/src/classes/models/client-configuration.model.ts +39 -0
- package/src/classes/models/ctrader-x-error.model.ts +16 -0
- package/src/config/config.ts +48 -0
- package/src/index.ts +4 -0
- package/src/models/common/ohlcv.ts +19 -0
- package/src/models/proto/base-proto.ts +13 -0
- package/src/models/proto/messages/authentication/ProtoOAAccountAuthReq.ts +8 -0
- package/src/models/proto/messages/authentication/ProtoOAAccountAuthRes.ts +3 -0
- package/src/models/proto/messages/authentication/ProtoOAApplicationAuthReq.ts +13 -0
- package/src/models/proto/messages/authentication/ProtoOAApplicationAuthRes.ts +3 -0
- package/src/models/proto/messages/common/ProtoOASubscribeSpotsReq.ts +6 -0
- package/src/models/proto/messages/common/ProtoOASubscribeSpotsRes.ts +3 -0
- package/src/models/proto/messages/symbols/ProtoOAGetTrendbarsReq.ts +29 -0
- package/src/models/proto/messages/symbols/ProtoOAGetTrendbarsRes.ts +30 -0
- package/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarReq.ts +7 -0
- package/src/models/proto/messages/symbols/ProtoOASubscribeLiveTrendbarRes.ts +3 -0
- package/src/models/proto/messages/symbols/ProtoOASymbolByIdReq.ts +8 -0
- package/src/models/proto/messages/symbols/ProtoOASymbolByIdRes.ts +15 -0
- package/src/models/proto/messages/symbols/ProtoOASymbolsListReq.ts +8 -0
- package/src/models/proto/messages/symbols/ProtoOASymbolsListRes.ts +14 -0
- package/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarReq.ts +11 -0
- package/src/models/proto/messages/symbols/ProtoOAUnsubscribeLiveTrendbarRes.ts +3 -0
- package/src/models/proto/models/ProtoOAArchivedSymbol.ts +21 -0
- package/src/models/proto/models/ProtoOAErrorRes.ts +20 -0
- package/src/models/proto/models/ProtoOAHoliday.ts +31 -0
- package/src/models/proto/models/ProtoOAInterval.ts +16 -0
- package/src/models/proto/models/ProtoOALightSymbol.ts +38 -0
- package/src/models/proto/models/ProtoOASpotEvent.ts +31 -0
- package/src/models/proto/models/ProtoOASymbol.ts +220 -0
- package/src/models/proto/models/ProtoOATrendbar.ts +11 -0
- package/src/models/proto/models/ProtoOATrendbarPeriod.ts +16 -0
- package/src/models/proto/payload-types/payload-types.enum.ts +77 -0
- package/src/utils/price.utils.ts +42 -0
- package/src/utils/sleep.utils.ts +13 -0
- package/src/utils/timeframe.utils.ts +50 -0
- package/src/utils/trendbar.utils.ts +59 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/vitest.config.ts +11 -0
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { CTraderConnection } from '@reiryoku/ctrader-layer';
|
|
2
|
+
import { ILogger, Logger } from './logger';
|
|
3
|
+
import { AuthenticationManager } from './managers/authentication/authentication.manager';
|
|
4
|
+
import { Config } from '../config/config';
|
|
5
|
+
import { ConnectionError } from './errors/connection.error';
|
|
6
|
+
import { cTraderXError } from './models/ctrader-x-error.model';
|
|
7
|
+
import { IConfiguration } from './models/client-configuration.model';
|
|
8
|
+
import { SymbolsManager } from './managers/symbols/symbols.manager';
|
|
9
|
+
import { ClientNotConnectedError } from './errors/client-not-connected.error';
|
|
10
|
+
import { SymbolsUpdatesManager } from './managers/symbols/symbols-updates.manager';
|
|
11
|
+
|
|
12
|
+
export class cTraderX {
|
|
13
|
+
private readonly port = 5035;
|
|
14
|
+
private readonly host: string;
|
|
15
|
+
private readonly logger: ILogger;
|
|
16
|
+
private readonly connection: CTraderConnection;
|
|
17
|
+
|
|
18
|
+
private readonly symbolsManager: SymbolsManager;
|
|
19
|
+
private readonly authManager: AuthenticationManager;
|
|
20
|
+
private readonly symbolsUpdatesManager: SymbolsUpdatesManager;
|
|
21
|
+
|
|
22
|
+
private isConnected = false;
|
|
23
|
+
|
|
24
|
+
constructor(config?: IConfiguration) {
|
|
25
|
+
this.host = config?.live
|
|
26
|
+
? `live.ctraderapi.com`
|
|
27
|
+
: `demo.ctraderapi.com`;
|
|
28
|
+
this.logger = config?.logger || new Logger();
|
|
29
|
+
|
|
30
|
+
const credentials = {
|
|
31
|
+
clientId: config?.clientId || Config.SPOTWARE_CLIENT_ID,
|
|
32
|
+
accessToken: config?.accessToken || Config.SPOTWARE_ACCESS_TOKEN,
|
|
33
|
+
clientSecret: config?.clientSecret || Config.SPOTWARE_CLIENT_SECRET,
|
|
34
|
+
ctidTraderAccountId:
|
|
35
|
+
config?.ctidTraderAccountId ||
|
|
36
|
+
Config.SPOTWARE_CTID_TRADER_ACCOUNT_ID,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
this.connection = new CTraderConnection({
|
|
40
|
+
host: this.host,
|
|
41
|
+
port: this.port,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
this.symbolsManager = new SymbolsManager(
|
|
45
|
+
credentials,
|
|
46
|
+
this.connection,
|
|
47
|
+
this.logger,
|
|
48
|
+
);
|
|
49
|
+
this.authManager = new AuthenticationManager(
|
|
50
|
+
credentials,
|
|
51
|
+
this.connection,
|
|
52
|
+
this.logger,
|
|
53
|
+
);
|
|
54
|
+
this.symbolsUpdatesManager = new SymbolsUpdatesManager(
|
|
55
|
+
credentials,
|
|
56
|
+
this.connection,
|
|
57
|
+
this.logger,
|
|
58
|
+
this.symbolsManager,
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
get symbols() {
|
|
63
|
+
this.ensureConnectedOrThrow();
|
|
64
|
+
return this.symbolsManager;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
get symbolsUpdates() {
|
|
68
|
+
this.ensureConnectedOrThrow();
|
|
69
|
+
return this.symbolsUpdatesManager;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
disconnect() {
|
|
73
|
+
this.connection.close();
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
async connect(): Promise<void> {
|
|
77
|
+
if (this.isConnected) return;
|
|
78
|
+
try {
|
|
79
|
+
await this.connection.open();
|
|
80
|
+
await this.authManager.authenticateApp();
|
|
81
|
+
await this.authManager.authenticateUser();
|
|
82
|
+
this.isConnected = true;
|
|
83
|
+
this.sendHeartbeat();
|
|
84
|
+
} catch (e) {
|
|
85
|
+
const message = cTraderXError.getMessageError(e);
|
|
86
|
+
this.logger.error(`Error opening connection: ${message}`);
|
|
87
|
+
throw new ConnectionError(message);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
private sendHeartbeat() {
|
|
92
|
+
if (!this.isConnected) return;
|
|
93
|
+
this.connection.sendHeartbeat();
|
|
94
|
+
setTimeout(() => {
|
|
95
|
+
this.sendHeartbeat();
|
|
96
|
+
}, 1000 * 9);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
private ensureConnectedOrThrow() {
|
|
100
|
+
if (!this.isConnected) throw new ClientNotConnectedError();
|
|
101
|
+
}
|
|
102
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Config } from '../config/config';
|
|
2
|
+
|
|
3
|
+
export interface ILogger {
|
|
4
|
+
debug(message: string): void;
|
|
5
|
+
log(message: string): void;
|
|
6
|
+
error(message: string): void;
|
|
7
|
+
warn(message: string): void;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export class Logger implements ILogger{
|
|
11
|
+
debug(message: string) {
|
|
12
|
+
if (Config.DEBUG_LOGS) console.log(`🐛 ${message}`);
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
log(message: string) {
|
|
16
|
+
console.log(`ℹ️ ${message}`);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
error(message: string) {
|
|
20
|
+
console.log(`❌ ${message}`);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
warn(message: string) {
|
|
24
|
+
console.log(`⚠️ ${message}`);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
// tests/managers/authentication.manager.test.ts
|
|
2
|
+
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
3
|
+
import { CTraderConnection } from '@reiryoku/ctrader-layer';
|
|
4
|
+
import { Config } from '../../../config/config';
|
|
5
|
+
import { ApplicationAuthenticationError } from './errors/application-auth.error';
|
|
6
|
+
import { UserAuthenticationError } from './errors/user-auth.error';
|
|
7
|
+
import { Logger } from '../../logger';
|
|
8
|
+
import { AuthenticationManager } from './authentication.manager';
|
|
9
|
+
|
|
10
|
+
describe('AuthenticationManager - Integration Tests', () => {
|
|
11
|
+
let connection: CTraderConnection;
|
|
12
|
+
let authManager: AuthenticationManager;
|
|
13
|
+
let logger: Logger;
|
|
14
|
+
|
|
15
|
+
const host = 'demo.ctraderapi.com';
|
|
16
|
+
const port = 5035;
|
|
17
|
+
|
|
18
|
+
beforeAll(async () => {
|
|
19
|
+
logger = new Logger();
|
|
20
|
+
|
|
21
|
+
connection = new CTraderConnection({
|
|
22
|
+
host,
|
|
23
|
+
port,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const credentials = {
|
|
27
|
+
clientId: Config.SPOTWARE_CLIENT_ID,
|
|
28
|
+
clientSecret: Config.SPOTWARE_CLIENT_SECRET,
|
|
29
|
+
accessToken: Config.SPOTWARE_ACCESS_TOKEN,
|
|
30
|
+
ctidTraderAccountId: Config.SPOTWARE_CTID_TRADER_ACCOUNT_ID,
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
authManager = new AuthenticationManager(
|
|
34
|
+
credentials,
|
|
35
|
+
connection,
|
|
36
|
+
logger,
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
// Apri la connessione prima dei test
|
|
40
|
+
await connection.open();
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
afterAll(async () => {
|
|
44
|
+
// Chiudi la connessione dopo i test
|
|
45
|
+
await connection.close();
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
describe('authenticateApp', () => {
|
|
49
|
+
it('should authenticate application successfully', async () => {
|
|
50
|
+
await expect(authManager.authenticateApp()).resolves.not.toThrow();
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it('should throw ApplicationAuthenticationError with invalid credentials', async () => {
|
|
54
|
+
const invalidConnection = new CTraderConnection({
|
|
55
|
+
host,
|
|
56
|
+
port,
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
await invalidConnection.open();
|
|
60
|
+
|
|
61
|
+
const invalidCredentials = {
|
|
62
|
+
clientId: 'invalid_client_id',
|
|
63
|
+
clientSecret: 'invalid_client_secret',
|
|
64
|
+
accessToken: Config.SPOTWARE_ACCESS_TOKEN,
|
|
65
|
+
ctidTraderAccountId: Config.SPOTWARE_CTID_TRADER_ACCOUNT_ID,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
const invalidAuthManager = new AuthenticationManager(
|
|
69
|
+
invalidCredentials,
|
|
70
|
+
invalidConnection,
|
|
71
|
+
logger,
|
|
72
|
+
);
|
|
73
|
+
|
|
74
|
+
await expect(invalidAuthManager.authenticateApp()).rejects.toThrow(
|
|
75
|
+
ApplicationAuthenticationError,
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
await invalidConnection.close();
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe('authenticateUser', () => {
|
|
83
|
+
it('should authenticate user successfully after app authentication', async () => {
|
|
84
|
+
// Prima autentica l'app
|
|
85
|
+
// await authManager.authenticateApp();
|
|
86
|
+
|
|
87
|
+
// Poi autentica l'utente
|
|
88
|
+
await expect(authManager.authenticateUser()).resolves.not.toThrow();
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
it('should throw UserAuthenticationError with invalid access token', async () => {
|
|
92
|
+
const invalidConnection = new CTraderConnection({
|
|
93
|
+
host,
|
|
94
|
+
port,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
await invalidConnection.open();
|
|
98
|
+
|
|
99
|
+
const validAppCredentials = {
|
|
100
|
+
clientId: Config.SPOTWARE_CLIENT_ID,
|
|
101
|
+
clientSecret: Config.SPOTWARE_CLIENT_SECRET,
|
|
102
|
+
accessToken: 'invalid_access_token',
|
|
103
|
+
ctidTraderAccountId: Config.SPOTWARE_CTID_TRADER_ACCOUNT_ID,
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const invalidAuthManager = new AuthenticationManager(
|
|
107
|
+
validAppCredentials,
|
|
108
|
+
invalidConnection,
|
|
109
|
+
logger,
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// Autentica prima l'app (che dovrebbe funzionare)
|
|
113
|
+
await invalidAuthManager.authenticateApp();
|
|
114
|
+
|
|
115
|
+
// Poi prova ad autenticare l'utente (che dovrebbe fallire)
|
|
116
|
+
await expect(invalidAuthManager.authenticateUser()).rejects.toThrow(
|
|
117
|
+
UserAuthenticationError,
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
await invalidConnection.close();
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
it('should throw UserAuthenticationError with invalid ctidTraderAccountId', async () => {
|
|
124
|
+
const invalidConnection = new CTraderConnection({
|
|
125
|
+
host,
|
|
126
|
+
port,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
await invalidConnection.open();
|
|
130
|
+
|
|
131
|
+
const invalidCredentials = {
|
|
132
|
+
clientId: Config.SPOTWARE_CLIENT_ID,
|
|
133
|
+
clientSecret: Config.SPOTWARE_CLIENT_SECRET,
|
|
134
|
+
accessToken: Config.SPOTWARE_ACCESS_TOKEN,
|
|
135
|
+
ctidTraderAccountId: 999999999, // ID non valido
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
const invalidAuthManager = new AuthenticationManager(
|
|
139
|
+
invalidCredentials,
|
|
140
|
+
invalidConnection,
|
|
141
|
+
logger,
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
await invalidAuthManager.authenticateApp();
|
|
145
|
+
|
|
146
|
+
await expect(invalidAuthManager.authenticateUser()).rejects.toThrow(
|
|
147
|
+
UserAuthenticationError,
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
await invalidConnection.close();
|
|
151
|
+
});
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
describe('Full authentication flow', () => {
|
|
155
|
+
it('should complete full authentication flow successfully', async () => {
|
|
156
|
+
const newConnection = new CTraderConnection({
|
|
157
|
+
host,
|
|
158
|
+
port,
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
await newConnection.open();
|
|
162
|
+
|
|
163
|
+
const credentials = {
|
|
164
|
+
clientId: Config.SPOTWARE_CLIENT_ID,
|
|
165
|
+
clientSecret: Config.SPOTWARE_CLIENT_SECRET,
|
|
166
|
+
accessToken: Config.SPOTWARE_ACCESS_TOKEN,
|
|
167
|
+
ctidTraderAccountId: Config.SPOTWARE_CTID_TRADER_ACCOUNT_ID,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const newAuthManager = new AuthenticationManager(
|
|
171
|
+
credentials,
|
|
172
|
+
newConnection,
|
|
173
|
+
logger,
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
// Test del flusso completo
|
|
177
|
+
await expect(
|
|
178
|
+
newAuthManager.authenticateApp(),
|
|
179
|
+
).resolves.not.toThrow();
|
|
180
|
+
await expect(
|
|
181
|
+
newAuthManager.authenticateUser(),
|
|
182
|
+
).resolves.not.toThrow();
|
|
183
|
+
|
|
184
|
+
await newConnection.close();
|
|
185
|
+
});
|
|
186
|
+
});
|
|
187
|
+
});
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { CTraderConnection } from '@reiryoku/ctrader-layer';
|
|
2
|
+
|
|
3
|
+
import { ILogger } from '../../logger';
|
|
4
|
+
import { BaseManager } from '../models/base.manager';
|
|
5
|
+
import { ICredentials } from '../models/credentials.model';
|
|
6
|
+
import { UserAuthenticationError } from './errors/user-auth.error';
|
|
7
|
+
import { ApplicationAuthenticationError } from './errors/application-auth.error';
|
|
8
|
+
import { ProtoOAAccountAuthReq } from '../../../models/proto/messages/authentication/ProtoOAAccountAuthReq';
|
|
9
|
+
import { ProtoOAApplicationAuthReq } from '../../../models/proto/messages/authentication/ProtoOAApplicationAuthReq';
|
|
10
|
+
|
|
11
|
+
export class AuthenticationManager extends BaseManager {
|
|
12
|
+
constructor(
|
|
13
|
+
protected readonly credentials: ICredentials,
|
|
14
|
+
protected readonly connection: CTraderConnection,
|
|
15
|
+
protected readonly logger: ILogger,
|
|
16
|
+
) {
|
|
17
|
+
super();
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
async authenticateApp() {
|
|
21
|
+
try {
|
|
22
|
+
this.logCallAttempt(this.authenticateApp);
|
|
23
|
+
|
|
24
|
+
const payload: ProtoOAApplicationAuthReq = {
|
|
25
|
+
clientId: this.credentials.clientId,
|
|
26
|
+
clientSecret: this.credentials.clientSecret,
|
|
27
|
+
};
|
|
28
|
+
await this.connection.sendCommand(
|
|
29
|
+
ProtoOAApplicationAuthReq.name,
|
|
30
|
+
payload,
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
this.logCallAttemptSuccess(this.authenticateApp);
|
|
34
|
+
} catch (e) {
|
|
35
|
+
throw this.handleCTraderCallError(
|
|
36
|
+
e,
|
|
37
|
+
this.authenticateApp,
|
|
38
|
+
new ApplicationAuthenticationError(e),
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
async authenticateUser() {
|
|
44
|
+
try {
|
|
45
|
+
this.logCallAttempt(this.authenticateUser);
|
|
46
|
+
|
|
47
|
+
const payload: ProtoOAAccountAuthReq = {
|
|
48
|
+
accessToken: this.credentials.accessToken,
|
|
49
|
+
ctidTraderAccountId: this.credentials.ctidTraderAccountId,
|
|
50
|
+
};
|
|
51
|
+
await this.connection.sendCommand(
|
|
52
|
+
ProtoOAAccountAuthReq.name,
|
|
53
|
+
payload,
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
this.logCallAttemptSuccess(this.authenticateUser);
|
|
57
|
+
} catch (e) {
|
|
58
|
+
throw this.handleCTraderCallError(
|
|
59
|
+
e,
|
|
60
|
+
this.authenticateUser,
|
|
61
|
+
new UserAuthenticationError(e),
|
|
62
|
+
);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { cTraderXError } from '../../../models/ctrader-x-error.model';
|
|
2
|
+
|
|
3
|
+
export class ApplicationAuthenticationError extends cTraderXError {
|
|
4
|
+
constructor(error: unknown) {
|
|
5
|
+
super(
|
|
6
|
+
`Application authentication error: ${cTraderXError.getMessageError(error)}`,
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { cTraderXError } from '../../models/ctrader-x-error.model';
|
|
2
|
+
import { ILogger } from '../../logger';
|
|
3
|
+
import { CTraderConnection } from '@reiryoku/ctrader-layer';
|
|
4
|
+
import { ICredentials } from './credentials.model';
|
|
5
|
+
import { ProtoOAErrorRes } from '../../../models/proto/models/ProtoOAErrorRes';
|
|
6
|
+
|
|
7
|
+
export abstract class BaseManager {
|
|
8
|
+
protected readonly logger: ILogger;
|
|
9
|
+
protected readonly credentials: ICredentials;
|
|
10
|
+
protected readonly connection: CTraderConnection;
|
|
11
|
+
|
|
12
|
+
protected logCallAttempt(method: Function, extra?: Record<string, any>) {
|
|
13
|
+
if (extra) {
|
|
14
|
+
this.logger.debug(
|
|
15
|
+
`Attempting ${method.name} call: ${JSON.stringify(extra)}`,
|
|
16
|
+
);
|
|
17
|
+
} else {
|
|
18
|
+
this.logger.debug(`Attempting ${method.name} call`);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
protected logCallAttemptSuccess(
|
|
23
|
+
method: Function,
|
|
24
|
+
extra?: Record<string, any>,
|
|
25
|
+
) {
|
|
26
|
+
if (extra) {
|
|
27
|
+
this.logger.debug(
|
|
28
|
+
`Call attempt to ${method.name} succeeded: ${JSON.stringify(extra)}`,
|
|
29
|
+
);
|
|
30
|
+
} else {
|
|
31
|
+
this.logger.debug(`Call attempt to ${method.name} succeeded`);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
protected logCallAttemptFailure(method: Function, error: unknown) {
|
|
36
|
+
this.logger.error(
|
|
37
|
+
`Call attempt to ${method.name} failed: ${cTraderXError.getMessageError(error)}`,
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
protected handleCTraderCallError(
|
|
42
|
+
error: ProtoOAErrorRes,
|
|
43
|
+
method: Function,
|
|
44
|
+
rethrowError: cTraderXError,
|
|
45
|
+
): cTraderXError {
|
|
46
|
+
const message = cTraderXError.getMessageError(error);
|
|
47
|
+
this.logCallAttemptFailure(method, message);
|
|
48
|
+
return rethrowError;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { IConfiguration } from '../../models/client-configuration.model';
|
|
2
|
+
|
|
3
|
+
export interface ICredentials extends Pick<
|
|
4
|
+
IConfiguration,
|
|
5
|
+
| 'clientId'
|
|
6
|
+
| 'clientSecret'
|
|
7
|
+
| 'ctidTraderAccountId'
|
|
8
|
+
| 'accessToken'
|
|
9
|
+
| 'accessToken'
|
|
10
|
+
> {
|
|
11
|
+
clientId: string;
|
|
12
|
+
accessToken: string;
|
|
13
|
+
clientSecret: string;
|
|
14
|
+
ctidTraderAccountId: number;
|
|
15
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { cTraderXError } from '../../../models/ctrader-x-error.model';
|
|
2
|
+
|
|
3
|
+
export class SubscribeLiveTrendBarsError extends cTraderXError {
|
|
4
|
+
constructor(error: unknown) {
|
|
5
|
+
super(
|
|
6
|
+
`Subscribe live trend bars error: ${cTraderXError.getMessageError(error)}`,
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export class SubscribeLiveTrendBarsInternalError extends cTraderXError {
|
|
12
|
+
constructor(error: unknown) {
|
|
13
|
+
super(
|
|
14
|
+
`[INTERNAL] Subscribe live trend bars error: ${cTraderXError.getMessageError(error)}`,
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { cTraderXError } from '../../../models/ctrader-x-error.model';
|
|
2
|
+
|
|
3
|
+
export class SubscribeSpotEventsError extends cTraderXError {
|
|
4
|
+
constructor(error: unknown) {
|
|
5
|
+
super(
|
|
6
|
+
`Subscribe spot events error: ${cTraderXError.getMessageError(error)}`,
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { cTraderXError } from '../../../models/ctrader-x-error.model';
|
|
2
|
+
|
|
3
|
+
export class UnsubscribeLiveTrendBarsError extends cTraderXError {
|
|
4
|
+
constructor(error: unknown) {
|
|
5
|
+
super(
|
|
6
|
+
`Unsubscribe live trend bars error: ${cTraderXError.getMessageError(error)}`,
|
|
7
|
+
);
|
|
8
|
+
}
|
|
9
|
+
}
|