Single API with Broker Portability and No-Code Strategy Deployment

Dear Traders,

What if you could switch brokers without rewriting a single line of code and run your trading strategies on your own system—without any coding knowledge?

Imagine you have a powerful Iron Condor strategy that you want to automate but don’t have the development skills to bring it to life. What if I told you that you could set up and execute this strategy simply by configuring a few parameters in a JSON file? It’s that easy.

All you need is a basic understanding of JSON and a little development know-how. Here’s how you can do it:

  1. Broker Portability: Switch brokers anytime without touching your code.
  2. No-Code Strategy Deployment: Define your strategy using standard parameters like legs, entry/exit rules, adjustments, etc., in a JSON format.
  3. Automated Execution: Deploy your strategy on your cloud server with minimal setup.

Would you be interested?

Here’s a sneak peek:

SingleApi singleApi = CreateBrokerSession(BrokerSecretConfig, SingleApiKey);
SingleApiTicker singleApiTicker = new SingleApiTicker(singleApi.getAccessToken, singleApi.getApiKey);
singleApiTicker.connect(dataSourceConfig);

Strategy juicyIronCondor = new BaseStrategy(StrategyConfig);
juicyIronCondor.start();

while(marketIsOpen) {
    juicyIronCondor.run();
}

And here’s a sample JSON for an Iron Condor strategy:

{
  "name": "Nifty Iron Condor Weekly",
  "index": "NIFTY",
  "expiryDate": "2023-06-01",
  "barTimeFrame": "5 minutes",
  "status": "INACTIVE",
  "globalRules": [
    {
      "type": "ENTRY",
      "ruleType": "TimeRule",
      "parameters": "09:15",
      "combinator": "AND"
    },
    {
      "type": "EXIT",
      "ruleType": "TimeRule",
      "parameters": "15:30",
      "combinator": "OR"
    }
  ],
  "legs": [
    {
      "direction": "SHORT",
      "transactionType": "SELL",
      "quantity": 50,
      "productType": "OPTION",
      "optionType": "CALL",
      "strikeSelectCriteria": "OTM1",
      "entryRules": [
        {
          "ruleType": "IndicatorRule",
          "indicatorType": "RSI",
          "parameters": "14",
          "condition": "OVER",
          "threshold": "60",
          "combinator": "AND"
        }
      ],
      "exitRules": [
        {
          "ruleType": "IndicatorRule",
          "indicatorType": "SMA",
          "parameters": "20",
          "condition": "CROSS_ABOVE",
          "threshold": "0",
          "combinator": "OR"
        }
      ],
      "stopLoss": {
        "type": "PERCENTAGE",
        "value": 50
      },
      "takeProfit": {
        "type": "PERCENTAGE",
        "value": 80
      },
      "allowReentry": true,
      "maxReentries": 1,
      "reentryCooldownBars": 3
    },
    // Additional legs here
  ]
}

Cool idea :100:

Just one suggestion: use something like YAML/TOML instead of JSON with a very beginner friendly tutorial and validator on your website. This could get more normal people interested in this, JSON as it is is not very human friendly, JSONC (JSON with comments) is better but still not very human friendly (no trailing commas) IMHO :person_shrugging:

Sure. All your ideas are good. I’ll keep those in mind while developing the product.

Dear @nithin,

I’m wondering if I should be concerned about any legal issues while building such an API. If there are potential concerns, I’d greatly appreciate your valuable insight into which aspects of the API might pose legal challenges. My goal is to ensure full compliance with SEBI regulations and avoid any legal complications.

To elaborate:

  1. The user configures their own strategy using YAML/JSON. My API will be responsible for building the strategy at runtime and executing it.
  2. The user’s broker credentials will remain on the user’s system and won’t be transmitted to my backend. User authorization will occur on the user’s end using our client API.
  3. The access token will be sent to my backend solely for placing orders. The token won’t be stored, just used for transactions with the broker.
  4. All market data, such as ticks and bars, will be stored on the user’s system. The bars will be transmitted to my backend only for execution purposes. My backend won’t store this data.
  5. The user will write code in their own code editor, using our API client for development. They will build the code and deploy it on their own cloud server. I may provide infrastructure for deployment or assist with automated cloud deployments.
  6. The user will pay for the API and, if they choose, for infrastructure as a service provided by me.

Are you sure you won’t get into the job of writing the code or advising the strategy? Because if it is just APIs, we offer it ourselves.

He is planning to build on Broker APIs, and looking to offer a little more flexibility wrt API, like “Entry/Exit Rules” (that can be selected using json files) and “Broker Portability”

If you are planning to build anything, I guess I’d ask you to wait for 2 or 3 months. Some regulations may be announced. Regulations for people selling strategies and trading using API.

Dear @nithin,

This API is essentially a wrapper on top of what brokers already offer, so yes, I’ll be building on the existing broker functionalities. However, I want to clarify that I won’t be getting into the business of advising or creating strategies for users. My role is purely to provide the tools that allow users to implement their own strategies more easily.

While users will configure their strategies, our backend will handle the execution based on the configurations provided by them. The strategy logic itself remains defined by the user, and we do not offer any advisory services or pre-built strategies.

While brokers do offer APIs, my focus is on simplifying the process for users by allowing them to configure and deploy their strategies without needing to write extensive code themselves.

Yeah, as I mentioned, it may be best if you give it a few months.

1 Like

As an individual trader using the API to place orders in my different accounts, should I be worried about SEBI’s new regulation regarding the use of APIs?

As an individual trader using API to place orders only in my own personal account, should I be worried ?

Previous consultation paper had absurd rules which were unimplementable for me - i cant disclose system rules and cannot run system within broker infra.

Yep, to both.

It will be regulated or banned ?
Regulation is ok but restriction on use is irritating

Will have to wait and see i guess, but regulation could be such that it effectively becomes a ban.

Atleast the consultation paper in 2021 was like that. Worst case scenario is something like that, requiring me to disclose algo to 3rd party ( they cant even keep mobile number secure…) and to execute via 3rd party.

Then we might have to automate through workaround methods, automate gui / browser etc - like how it used to be earlier.

Best case is that something sane and workable comes and uncertainty gets removed for all, but i am not too hopeful. Also why cant they restrict all of this to algo sellers ?

1 Like

@Ashish_Tyagi @SpacemanSpiff
You guys asked for it with “Should I be worried” :grinning:

I hope even if Algo Trading gets banned, we continue to get the data via API (which I suppose will then would have to be paid for everywhere)

1 Like

Then Jio will come and say all free :rofl::rofl:

It will be regulated.

This is happening soon. People can sell strategies which are only performance-validated, so in a sense 90%+ algo sellers will disappear.

if ordering via api gets banned, then i hope everything but that remains, ill pay for it as usual. quote api is useful and nicely designed along with websockets etc.

Kotak still offers Nest i think, and Nest can be used for a lot of things if things completely disappear. But don’t want to switch brokers or even to Nest as then i will have to go back to windows …

This is fair enough i guess, but how will they validate it in time assuming its forward test only ? Usually systems need time to work out, just a few months of data will not be reliable for both performance and esp risk.

Anyway, that is not my concern. If this is already happening - what do they intend to do with api?
Why restrict people who trade their own systems in their own account ? Any idea what kind of regulations we can expect ?

Dear @nithin, do you think the regulations will apply uniformly to all platforms, regardless of whether they are selling proprietary strategies or simply executing user-created strategies? Or do you believe there will be a clear distinction made, with only those selling strategies being targeted, leaving strategy executors unaffected?

Yeah, we have to wait it out.