Seven new endpoints have been added to the P123 API

New API Endpoints

Seven new endpoints have been added to the P123 API.

All seven are implemented in the p123api Python wrapper; see the method list at the end.

Ranking systems

New endpoints to read an existing ranking system and to create one from scratch. Together these let you pull an existing ranking system's XML, modify it, and post it back as a new system.

GET /rank

Returns a ranking system, looked up by either ID or name.

POST /rank/create

Creates a new ranking system and returns its UID.

Returns an error if the name conflicts with an existing ranking system.

Copying strategies and books

Two endpoints for cloning existing objects, equivalent to Save-As in the web interface. Copy a simulated or live strategy as a new sim or live strategy, or a simulated or live book as a new sim or live book.

This lets you build a strategy or book in the web interface as a template, with access to every setting, and then clone it from the API.

The copy inherits the original's category and sharing settings. The new name must be unique across all live and simulated strategies and books.

POST /strategy/{id}/copy

Copies an existing strategy.

POST /strategy/{id}/copy-book

Copies an existing book.

Other lookups

Three more GET endpoints resolve an object by either its ID or its name.

GET /strategy

Returns strategy or book info.

GET /dataSeries

Returns data series info.

GET /stockFactor

Returns imported stock factor info.

Python wrapper

Every new endpoint is available in the p123api Python client as of version 3.1.0, which requires Python 3.10 or later.

pip install --upgrade p123api
Endpoint Method
GET /rank rank_get(id=) or rank_get(name=)
POST /rank/create rank_create(name, nodes, rankingMethod=, type=, currency=)
POST /strategy/{id}/copy strategy_copy(id, name, type=)
POST /strategy/{id}/copy-book book_copy(id, name, type=)
GET /strategy strategy_info(id=) or strategy_info(name=)
GET /dataSeries data_series_info(id=) or data_series_info(name=)
GET /stockFactor stock_factor_info(id=) or stock_factor_info(name=)
3 Likes