@sharplygroup/xtb-api-js
Version:
A module for interacting with the XTB API
73 lines (51 loc) • 1.44 kB
Markdown
A NodeJS library for interacting with the XTB API. It provides functionalities for account operations, market data, trading operations, and more.
- [Installation](
- [Usage](
- [Contributing](
- [License](
- [Support](
- [Credits](
```bash
npm install @sharplygroup/xtb-api-js
```
or
```bash
yarn add @sharplygroup/xtb-api-js
```
```javascript
const {
WebSocketManager,
AccountOperations,
} = require("@sharplygroup/xtb-api-js");
const wsManager = new WebSocketManager({
userId: "your_user_id", // Replace with your user ID
password: "your_password", // Replace with your password
demo: true, // Set to false for live account
});
async function getAccountData() {
try {
await wsManager.connect();
const accountOperations = new AccountOperations(wsManager);
const accountData = await accountOperations.getCurrentUserData();
console.log(accountData);
} catch (error) {
console.error(error);
} finally {
await wsManager.disconnect();
}
}
getAccountData();
```
Contributions are welcome! Please fork the repository and submit a pull request with your changes.
[](LICENSE)
Please open an issue on GitHub for any questions or problems.
Acknowledgment of any contributors or dependencies.