Repository navigation
Releases
OpenAlgo MATLAB Library 1.1.0
OpenAlgo MATLAB Library 1.1.0
Trade through your own OpenAlgo server from MATLAB: the Command Window, a live script or a scheduled matlab -batch job. This release fixes host name verification on the Java TLS provider, adds tls_ca_file for servers with a private CA, and changes the default strategy name to "MATLAB".
What changed in 1.1.0
Security
- The Java TLS provider now verifies the server's host name. In 1.0.0 it checked only the certificate chain, so a valid certificate issued for a different host was accepted on
wss://connections that used Java. The .NET and MATLAB Python interface providers already checked the host name; all three providers now do. Upgrade if you connect to a hostedwss://server, especially when Java is the provider (it is picked when neither .NET nor the MATLAB Python interface is available, or whentls_transportis"java").
Added
tls_ca_fileon the feed client: a PEM file of CA certificates trusted in addition to the system trust store, for awss://server whose certificate comes from a private CA. Set it beforeconnect(); the host name is still verified.
client.tls_ca_file = "C:\certs\my-private-ca.pem";
client.connect();Behaviour change
- The default strategy name is now
"MATLAB". Orders and requests sent without astrategyargument (placeorder,placesmartorder,basketorder,splitorder,orderstatus,openposition,modifyorder,cancelorder,closeposition,cancelallorder,optionsorder,placegttorder,modifygttorder,cancelgttorder) are now taggedMATLABinstead ofPython. If you filter the order book, close positions or cancel orders by the default strategy name, update those filters or passstrategy=explicitly. Calls that pass a strategy name are not affected.
Fixed
- Help text: every method with a strategy default states
Default "MATLAB"., the calling convention inhelp openalgoandhelp openalgo.apiis described on its own terms, the utility and management methods have their own heading, andhelp openalgo.FeedAPIexplains that anhttps://host derives thewss://<host>/wsfeed URL by itself.
Install
Download openalgo-matlab-1.1.0.mltbx from the assets below and double-click it in MATLAB, or install it from the Command Window:
matlab.addons.install("openalgo-matlab-1.1.0.mltbx");
openalgo.version() % '1.1.0'Or clone the repository and add the folder that contains +openalgo to the MATLAB path:
addpath("C:\path\to\openalgo-matlab-library")Quick start
client = openalgo.api(api_key=getenv("OPENALGO_API_KEY"), host="http://127.0.0.1:5000");
client.ping() % API key and broker session check
resp = client.placeorder(strategy="MATLAB Strategy", symbol="SBIN", action="BUY", ...
exchange="NSE", price_type="MARKET", product="MIS", quantity=1);
df = client.history(symbol="SBIN", exchange="NSE", interval="5m", ...
start_date="2025-04-01", end_date="2025-04-08"); % a timetableWhat it covers
- Orders: place, smart, basket, split, modify, cancel, cancel all, close position, order status, open position.
- GTT orders: SINGLE and OCO triggers, modify, cancel, GTT order book, with impossible trigger specs refused before anything is sent.
- Market data: quotes, multi-quotes, depth, symbol, search, history (as a timetable), ticker (JSON or text rows), intervals, expiry, instruments (as a table), synthetic future.
- Account: funds, order book, trade book, position book, holdings, margin, sandbox P&L by symbol, analyzer status and toggle.
- Options: option chain, option symbol, options order, multi-leg options order, Greeks for one option or up to 50 at once.
- Strategy module: list, status, start, stop, close all, close leg, runs, orders and events, plus
openalgo.Strategyfor the strategy webhook (batch start/stop and signal entries/exits). - Notifications and utilities: Telegram and WhatsApp alerts, Telegram bot management, market holidays and timings, chart preferences,
ping. - Live WebSocket feed: LTP, quotes, market depth (5, 20, 30 or 50 levels where the broker supports them) and real-time order updates, with callbacks or polling, automatic reconnect with subscription replay,
verboselogging, andwait,unsubscribe_all,get_broker_info,get_supported_brokersandws_ping. - Hosted servers: give the client
https://yourdomain.comand the feed connects towss://yourdomain.com/wsby itself. Secure WebSocket runs over .NET on Windows, MATLAB's Python interface (Python 3.9 to 3.13) or Java, with certificate and host name verification on every provider.
Good to know
- Arguments are name=value pairs with exact, case-sensitive names.
- Responses are MATLAB structs: JSON
nullbecomes[], and a one-element list of records becomes a 1x1 struct. - Server and network problems come back as an error struct (
status,message,error_type) instead of stopping your script; wrong arguments raise MATLAB errors withopenalgo:*identifiers. - Feed callbacks fire while MATLAB is idle or during
pause; useclient.wait(seconds)inmatlab -batchscripts. - Displaying the client never shows your API key.
- Every method has its own help text:
help openalgo.api/placeorder.
Requirements
- Tested on MATLAB R2026b.
- Base MATLAB only: no toolboxes. A local
ws://feed needs nothing else. - A running OpenAlgo server. Use analyzer (sandbox) mode while you try things out.
Documentation
- MATLAB library docs: https://docs.openalgo.in/trading-platform/matlab
- API reference: https://docs.openalgo.in/api-documentation/v1
- Changes: see
CHANGELOG.md.
OpenAlgo MATLAB library 1.0.0
OpenAlgo MATLAB Library 1.0.0
The first release of the OpenAlgo MATLAB library. Trade through your own OpenAlgo server from MATLAB: the Command Window, a live script or a scheduled matlab -batch job.
Install
Download openalgo-matlab-1.0.0.mltbx from the assets below and double-click it in MATLAB, or install it from the Command Window:
matlab.addons.install("openalgo-matlab-1.0.0.mltbx");
openalgo.version() % '1.0.0'Or clone the repository and add the folder that contains +openalgo to the MATLAB path:
addpath("C:\path\to\openalgo-matlab-library")A MATLAB File Exchange listing will follow.
Quick start
client = openalgo.api(api_key=getenv("OPENALGO_API_KEY"), host="http://127.0.0.1:5000");
client.ping() % API key and broker session check
resp = client.placeorder(strategy="MATLAB Strategy", symbol="SBIN", action="BUY", ...
exchange="NSE", price_type="MARKET", product="MIS", quantity=1);
df = client.history(symbol="SBIN", exchange="NSE", interval="5m", ...
start_date="2025-04-01", end_date="2025-04-08"); % a timetableWhat it covers
- Orders: place, smart, basket, split, modify, cancel, cancel all, close position, order status, open position.
- GTT orders: SINGLE and OCO triggers, modify, cancel, GTT order book, with impossible trigger specs refused before anything is sent.
- Market data: quotes, multi-quotes, depth, symbol, search, history (as a timetable), ticker (JSON or text rows), intervals, expiry, instruments (as a table), synthetic future.
- Account: funds, order book, trade book, position book, holdings, margin, sandbox P&L by symbol, analyzer status and toggle.
- Options: option chain, option symbol, options order, multi-leg options order, Greeks for one option or up to 50 at once.
- Strategy module: list, status, start, stop, close all, close leg, runs, orders and events, plus
openalgo.Strategyfor the strategy webhook (batch start/stop and signal entries/exits). - Notifications and utilities: Telegram and WhatsApp alerts, Telegram bot management, market holidays and timings, chart preferences,
ping. - Live WebSocket feed: LTP, quotes, market depth (5, 20, 30 or 50 levels where the broker supports them) and real-time order updates, with callbacks or polling, automatic reconnect with subscription replay,
verboselogging, andwait,unsubscribe_all,get_broker_info,get_supported_brokersandws_ping. - Hosted servers: give the client
https://yourdomain.comand the feed connects towss://yourdomain.com/wsby itself. Secure WebSocket runs over .NET on Windows, MATLAB's Python interface (Python 3.9 to 3.13) or Java, with certificate verification on.
Good to know
- Arguments are name=value pairs with exact, case-sensitive names.
- Responses are MATLAB structs: JSON
nullbecomes[], and a one-element list of records becomes a 1x1 struct. - Server and network problems come back as an error struct (
status,message,error_type) instead of stopping your script; wrong arguments raise MATLAB errors withopenalgo:*identifiers. - Feed callbacks fire while MATLAB is idle or during
pause; useclient.wait(seconds)inmatlab -batchscripts. - Displaying the client never shows your API key.
- Every method has its own help text:
help openalgo.api/placeorder.
Requirements
- Tested on MATLAB R2026b.
- Base MATLAB only: no toolboxes. A local
ws://feed needs nothing else. - A running OpenAlgo server. Use analyzer (sandbox) mode while you try things out.
Documentation
- MATLAB library docs: https://docs.openalgo.in/trading-platform/matlab
- API reference: https://docs.openalgo.in/api-documentation/v1
- Changes: see
CHANGELOG.md.