autotrade-mofid
Python library for buy and sell limit orders on Mofid EasyTrader.
from autotrade import buy, sell
buy("فولاد", 10, dry_run=True) # prepare only
buy("تمشک", 92, price_mode="fixed", price=54370)
sell("تمشک", 92, price_mode="fixed", price=54360)
Login uses Playwright; orders go over EasyTrader’s unofficial MTS HTTP API.
Automates real money. Start with
dry_run=True. Use at your own risk.
Install into another project
pip install autotrade-mofid
playwright install chrome
Optional CLI (python -m autotrade …):
pip install "autotrade-mofid[cli]"
Set credentials in the environment or a .env next to your app:
export MOFID_USER=…
export MOFID_PASS=…
# or: export AUTOTRADE_ENV=/path/to/.env
Or pass them per call:
from autotrade import buy
buy("فولاد", 1, dry_run=True, username="09…", password="…")
API
| Call | Purpose |
|---|---|
buy(symbol, qty, **opts) |
Buy helper |
sell(symbol, qty, **opts) |
Sell helper |
Order / place_order / with_account |
Lower-level control |
OrderError |
Bad arguments |
TradeError |
Broker rejected or did not keep the order |
Common options for buy / sell:
price_mode—auto(default),ceiling,floor,reference,fixedprice— Rial; required forfixedtarget_time—"now"(default) or"HH:MM:SS"on the broker clockdry_run— prepare only, no submitusername/password— both together, or omit both and use env /.env
from autotrade import Order, get_settings, place_order, with_account
account = with_account(get_settings())
order = Order.resolve(
account,
side="buy",
symbol="فولاد",
quantity=10,
price_mode="auto",
target_time="08:44:58",
dry_run=True,
)
place_order(order, account)
Develop this repo
python3.15 -m venv .venv
source .venv/bin/activate
pip install -e ".[dev]"
playwright install chrome
cp .env.example .env
pytest -q
If Chrome is missing, install Chromium and switch channel="chrome" →
channel="chromium" in autotrade/browser.py.
How it works
- Reuse a cached JWT, or log in with Playwright and harvest
Authorization: Bearer … - Resolve symbol → ISIN, live quote, commission
- Wait for the broker clock when
target_timeis not"now" - Submit
POST /core/api/v2/orderuntil accepted (or a hard rejection) - Treat success as order still on the book or cash moved
Licence
MIT
Metadata
Release files for autotrade-mofid 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| autotrade_mofid-0.1.1.tar.gz | 29.8 kB | Without provenance | Details for autotrade_mofid-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| autotrade_mofid-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for autotrade_mofid-0.1.1-py3-none-any.whl |
Total release size: 60.2 kB
Release files / autotrade_mofid-0.1.1.tar.gz
| Download URL | autotrade_mofid-0.1.1.tar.gz |
|---|---|
| Size | 29.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3d04db529b30adb41f9eb9cfae0103aadefe14a95cbf15057712c6fe5f324be9
|
|
BLAKE2b-256 checksum How to use checksums |
033b9952ab7d80de6f54c8c7db70bdaaee1ff1425b5b987831692d151659bfe5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Release files / autotrade_mofid-0.1.1-py3-none-any.whl
| Download URL | autotrade_mofid-0.1.1-py3-none-any.whl |
|---|---|
| Size | 30.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cf856ce30a3df307fb68fbf31cfeafbf76d727dcf8827ffd3a13c10f9134d418
|
|
BLAKE2b-256 checksum How to use checksums |
3aebc497e821699015918bba488ad3077ce0fea3e834a79a916636ff390f0c6b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.15.2
|
Security for autotrade-mofid 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.