fm-sdk-python
Python SDK for the Flexemarkets API.
⚠️ Alpha software — the API is not stable
fm-sdk is pre-1.0 and under active development. Anything public may be added, renamed, or removed in any release, including in ways that break code that compiles and runs today, and without a deprecation period first. Under semantic versioning a
0.xrelease carries no compatibility promise, and that is how these versions are used: treat every0.xbump as potentially breaking.Pin an exact version rather than a range (
fm-sdk==0.2.0, not>=0.2), read the upgrade notes for the release you are moving to, and expect to change code when you move.Not recommended for production use.
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
# 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)
market_id = markets[0].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)
# Live market data: a desk keeps the books and tapes for you -- it seeds
# them over REST, applies deltas, and re-seeds after a sequence gap.
with fm.desk(marketplace_id) as desk:
desk.on_book_change(market_id, lambda book: print(book.best_price("BUY")))
desk.on_session_change(lambda session: print(session.state))
desk.on_holding_change(lambda holding: print(holding.cash))
one = desk.book(market_id) # one market
for book in desk.books(): # every market in the marketplace
print(book.symbol, book.best_price("BUY"))
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 123
Options:
| Flag | Description |
|---|---|
-C, --credential |
Credential file path or bearer token |
-E, --endpoint |
Marketplace id, 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.3.3
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 | |
|---|---|---|---|---|
| fm_sdk-0.3.3.tar.gz | 78.3 kB | With provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| fm_sdk-0.3.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 126.4 kB
Release files / fm_sdk-0.3.3.tar.gz
| Download URL | fm_sdk-0.3.3.tar.gz |
|---|---|
| Size | 78.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
f8b349c3f4ab2172bef8d28370a304df1476f8cd02cd200e983bd3a53616923f
|
|
BLAKE2b-256 checksum How to use checksums |
e3691e1bf9712cd4307d2deea04e32cbba6051ff978a59a3677eca2d375719cd
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logRelease files / fm_sdk-0.3.3-py3-none-any.whl
| Download URL | fm_sdk-0.3.3-py3-none-any.whl |
|---|---|
| Size | 48.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2cb828cd1ea2dbd2cf1463e5beb0c322a106547c385afb865e337904c2e57482
|
|
BLAKE2b-256 checksum How to use checksums |
08464139b8b6d3e0b130944f6f06cdc1f13d66a984f37d428fd44793efed27af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logSecurity for fm-sdk 0.3.3
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for fm_sdk-0.3.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 23, 2026.
Transparency logA 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.