A previous release had provenance metadata, but this release does not. View details.
fm-sdk-python
Python SDK for the Flexemarkets API.
Requirements
- Python 3.11+
Install
pip install fm-sdk
Configuration
The SDK loads credentials and endpoint from these sources (highest priority first):
- Arguments passed to
Flexemarkets.connect() - Files
~/.fm/credentialand~/.fm/endpoint(Java.propertiesformat) - Environment variable
FM_API_URL(defaults tohttps://api.flexemarkets.com)
Credential file
Create ~/.fm/credential:
account=myaccount
email=user@example.com
password=secret
Or use a bearer token:
token=eyJhbGciOiJIUzI1NiJ9...
Endpoint file
Create ~/.fm/endpoint:
endpoint=https://api.flexemarkets.com/api/marketplaces/123
SDK usage
from fm import Flexemarkets, OrderBooks, MarketplaceTrades
# Connect
fm = Flexemarkets.connect(
credential="~/.fm/credential",
endpoint="https://api.flexemarkets.com/api/marketplaces/123",
client_description="my-bot",
)
# REST API
marketplace_id = fm.endpoint_marketplace_id
markets = fm.markets(marketplace_id)
session = fm.session(marketplace_id)
holdings = fm.holdings(marketplace_id)
# Submit orders
order = fm.submit_limit(marketplace_id, market_id, "BUY", units=1, price=950)
fm.submit_cancel(marketplace_id, market_id, order.id)
# WebSocket events
import queue
q = queue.Queue(maxsize=1000)
fm.listen(marketplace_id, q)
books = OrderBooks(markets)
trades = MarketplaceTrades(markets)
while True:
event = q.get()
match event:
case list() as orders:
books.update(orders)
trades.update(orders)
case Session() as s:
print(s.state)
case Holding() as h:
print(h.cash)
fm.close()
The client also works as a context manager:
with Flexemarkets.connect(credential, endpoint, "my-bot") as fm:
...
Applications
ticker
Live terminal display of order book best bid/ask, spread, and recent trade prices.
python3.11 ticker.py -C ~/.fm/credential -E https://api.flexemarkets.com/api/marketplaces/123
Options:
| Flag | Description |
|---|---|
-C, --credential |
Credential file path or bearer token |
-E, --endpoint |
Marketplace endpoint file path or URL |
Output:
fm-ticker OPEN
Symbol Bid Ask Spread Last trades
------ ------ ------ ------ -----------
AAPL $ 9.50 $10.50 $ 1.00 $9.50 $10.00
IBM $ 4.00 $ 5.00 $ 1.00 $4.50
The display refreshes on each order book update. Press Ctrl-C to stop.
Metadata
Release files for fm-sdk 0.0.8
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Loss of provenance
These files do not have provenance metadata, despite files in a prior release including this data.
We recommend further investigation before installing these files. View details.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| fm_sdk-0.0.8.tar.gz | 34.0 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fm_sdk-0.0.8-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 62.2 kB
Release files / fm_sdk-0.0.8.tar.gz
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | fm_sdk-0.0.8.tar.gz |
|---|---|
| Size | 34.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
75192cd5fdc1809eb3fff5cd005946238326e360ab3ad8f4bfa4e488b5a7f688
|
|
BLAKE2b-256 checksum How to use checksums |
3bf816292f88a9fdd805e886895826ea66d2a4621c4037fd94ba9b3f5ed65e09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / fm_sdk-0.0.8-py3-none-any.whl
Loss of provenance
This file belongs to a release without provenance metadata, despite a prior release including this data.
We recommend further investigation before installing this file. View details.
| Download URL | fm_sdk-0.0.8-py3-none-any.whl |
|---|---|
| Size | 28.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
11037d3f2fe511cbfc455ee50389ddfc9b25bd51cf80412d71c5d9cb27b75505
|
|
BLAKE2b-256 checksum How to use checksums |
71eb20eb44ad8cb4267fb8b172662287a84e81cfa4dd1c45de7ab5b895aa0046
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for fm-sdk 0.0.8
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.
Loss of provenance
A previous release of these files had provenance metadata, but this release does not.
While this could reflect a routine change by the project maintainers, it may also indicate that the release files have been compromised.
Release comparison
- Removed 0.0.6 2 files With provenance
- Added 0.0.8 2 files Without provenance
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.