Metadata-Version: 2.3
Name: xt-manager
Version: 0.3.0
Summary: XT Manager client (pip install, same shape as mt5manager).
Author: Xtention
Author-email: Xtention <pulkit.sahu@xtentioncrew.tech>
Requires-Dist: httpx>=0.28.1
Requires-Dist: pydantic>=2.14.1
Requires-Dist: websocket-client>=1.8.0
Requires-Dist: fastapi[standard]>=0.162.0 ; extra == 'api'
Requires-Python: >=3.11
Project-URL: Homepage, https://github.com/xt-crew-org/xt-terminal-monorepo
Provides-Extra: api
Description-Content-Type: text/markdown

# xt-manager

Python client for XT Manager, used the same way as MetaQuotes `mt5manager`:

```python
import XTManager

manager = XTManager.ManagerAPI()
manager.Connect("127.0.0.1:8443", 2504, "password", 0, 30000)
```

```bash
pip install xt-manager
```

From this repo during development:

```bash
pip install -e apps/xt-manager
```

Connect uses the manager id and the trading-account master password. Callers connect to the Access Server. Access forwards `/xt-manager/` to `broker-api-go`, which is the process started with `pnpm nx run broker-api-go:serve`. There is no separate manager API process.

## Order

1. Start broker-api-go and the Access Server.
2. Connect with the manager login, that account's master password, and the Access address (`127.0.0.1:8443` in local development).

The Python package remains the client library. Account, order, deal, and position records are stored by broker-api-go. The password stays out of the repository.

While a session is open, broker-api-go logs the manager login and caller address. A connected manager can call `OnlineTotal`, `OnlineNext`, and `OnlineGet`. `Type` is `34` for a manager connection.

User calls use the Manager API names and the user record field names: `UserRequest`, `UserGet`, `UserRequestByGroup`, `UserRequestByLogins`, `UserRequestArray`, `UserTotal`, `UserGroup`, `UserLogins`, `UserUpdate`, `UserUpdateBatch`, `UserAdd`, `UserDelete`, `UserPasswordCheck`, `UserPasswordChange`, and `UserBalanceCheck`. `UserPasswordCheck` and `UserPasswordChange` take `(type, login, password)`. Type `0` is the main password. The password is not returned. `UserAdd` creates the next trading login under the connected manager id.

Trading calls use the same names: orders (`OrderAdd`, `OrderUpdate`, `OrderCancel`, `OrderRequest`, `OrderRequestOpen`, and the by-group, by-logins, and by-tickets forms), closed orders (`HistoryRequest` and the same filters), positions (`PositionRequest`, `PositionGet`, `PositionUpdate`, `PositionDelete`), and deals (`DealAdd`, `DealPerform`, `DealRequest`, `DealUpdate`, `DealDelete`). `DealRequest(login, start, end)` and `PositionRequest(login)` return lists. `DealPerform` with entry `0` opens a position and entry `1` closes it and adds profit to the balance.

`DealerBalance(login, amount, type, comment)` writes a balance deal when type is `2` and a credit deal when type is `3`, and returns the deal ticket. `GroupUpdate`, `GroupRequest`, `GroupTotal`, `SymbolUpdate`, `SymbolRequest`, `SymbolExist`, `UserAccountRequest`, and `TimeServer` read and write the matching records. Prices, volumes, and money fields are decimal strings.
