Skip to main content

mftik

The strategy SDK and command-line client for a MFTIK node — a self-hosted, mid-frequency algorithmic trading platform.

You run the node yourself with Docker Compose — mftik node-init writes the stack for you. This package is both that and what you install on the machine you write strategies on.

pip install mftik

Writing a strategy

A strategy is a subclass of Strategy and a directory of .py files. It reads market data through the hooks it overrides and trades through the accessors the base class binds.

from mftik.strategy import Strategy


class MyStrategy(Strategy):
    name = "my_strategy"

    async def on_best_quote(self, quote) -> None:
        await self.log(f"{quote.universal_ticker} {quote.bid}/{quote.ask}")

self.oms places and cancels orders, self.ledger reads balances, self.mds queries history the feeds do not carry, self.tape warms up on prints from before the session started, self.symbols gives you the tick and step sizes to round to, and self.timer schedules work. See Strategy's docstring for the full set of hooks.

A session that was running when STS went away can come back. Override on_rebuild and set rebuildable = True. Facts you remember while running are handed back there, before on_start; resting orders, fills and position come from recon, not from anything you stored. Leave rebuildable off if coming back would mean trading beside orders you no longer know are yours.

A strategy may import the standard library, mftik, and other files in its own directory — nothing else. The node runs the source you send it rather than an environment you built, so a third-party import would be a module that is not there. mftik check tells you before you push.

The client

mftik node-init ./mynode                 # a whole node: compose, edge, .env
mftik connect https://node.example.com   # sign in once; stores an API key
mftik whoami                             # who you are to that node
mftik profiles                           # every node this machine knows
mftik disconnect <name>                  # forget one
mftik init ./hello                       # scaffold, filled in from that node
mftik check ./hello                      # import gate and on_initialized, offline
mftik run ./hello                        # push, deploy, tail; ^C stops it
mftik push ./hello                       # copy the tree into the node's private registry
mftik run ./hello                        # push, deploy, tail the session log
mftik ps                                 # what is running
mftik logs -f <session>                  # what it is saying
mftik stop <session>                     # stop it

connect signs in with your password, mints an API key through that session, stores the key and drops the session — so the password is never written down. Profiles live in ~/.config/mftik/config.toml at mode 0600. For CI, pass an existing key with --token and no prompt is reached.

init is being built — see docs/CLI.md for the shape it is landing in.

License

MIT

Metadata

Release files for mftik 0.12.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mftik 0.12.1
File Size Uploaded Provenance Actions
mftik-0.12.1.tar.gz 782.3 kB Without provenance Details for mftik-0.12.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for mftik 0.12.1
File Interpreter ABI Platform Actions
mftik-0.12.1-py3-none-any.whl Python 3 none any Details for mftik-0.12.1-py3-none-any.whl

Total release size: 1.5 MB

Release files / mftik-0.12.1.tar.gz

Download URL mftik-0.12.1.tar.gz
Size 782.3 kB
Tags Source
SHA-256 checksum
How to use checksums
0a0b8b212d964a0ef880c8bbb8d90e2883929c38a0b14ec856aeeb4140b2d3b0
BLAKE2b-256 checksum
How to use checksums
e97b7c4bc9f5a238ed6b8407f27e1f48871c9a770d6f007cd76fdefc3ead1da6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / mftik-0.12.1-py3-none-any.whl

Download URL mftik-0.12.1-py3-none-any.whl
Size 671.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64277d9eed2b21c92b60ff95887afdac9e9a658128107d670cb3da4ddb246fd5
BLAKE2b-256 checksum
How to use checksums
fd6da57aac7daf6e426b91edc312f114f9a5dea1acac852907447a190400819a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for mftik 0.12.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.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page