Introduction

    API Endpoint

        https://fyapi.algomojo.com/1.0/

                

Algomojo API Bridge which helps traders/investors to build, monitor, execute their trading requirement automatically.

To use this API, you need an API key. Please login to your algomojo broker terminal to get your own API key.

fy.algomojo.com

Version and API root URL
The current major stable version of the API is 1.0. All requests go to it by default. It is recommended that a specific version be requested explicity for production applications as major releases may break older implementations.

Root URL
https://fyapi.algomojo.com/1.0/

Each rest call will have 3 compulsory request parameters
1. api_key
2. api_secret
3. data
api_key is a key allocated to the User. Input will be in string format.
api_secret is a id received as response from Login 2FA.Input will be in string format.
data is a JSON object which is referred as Input in rest description table. If there is no input mentioned in the table you need to send it as a blank object or a blank string. Input will be in string format.

NOTE: - All APIs are considered as POST method. All the input as well as output data type will be in string format unless its mentioned in rest explanation section.


Fytoken


Indicator Format Description
Exchange 2 Digits Exchange of the symbol
Segment 2 Digits Segment of the symbol
Expiry 6 Digits Format: YYMMDD
Eg: 200827
Exchange Token From 2 upto 6 Digits The token assigned for the symbol by the exchange
Eg: 22

Exchanges


Possible Values Description
10 NSE (National Stock Exchange)
11 MCX (Multi Commodity Exchange)
12 BSE (Bombay Stock Exchange)

Segments


Possible Values Description
10 Capital Market
11 Equity Derivatives
12 Currency Derivatives
20 Commodity Derivatives

Product Types


Possible Values Description
CNC For equity only
INTRADAY Applicable for all segments
MARGIN Applicable only for derivatives
CO Cover Order
BO Bracket Order

Order Types


Possible Values Description
1 Limit order
2 Market order
3 Stop order (SL-M)
4 Stoplimit order (SL-L)

Order Sides


Possible Values Description
1 Buy
-1 Sell

Order Status


Possible Values Description
1 Cancelled
2 Traded / Filled
3 For future use
4 Transit
5 Rejected
4 Pending

Order Sides


Possible Values Description
1 Long
-1 Short
0 Closed position

Symbology Format


Segment Format Examples
Equity {Ex}:{Ex_Symbol}-{Series} NSE:SBIN-EQ, NSE:ACC-EQ,
NSE:MODIRUBBER-BE
BSE:SBIN-A, BSE:ACC-A,
BSE:MODIRUBBER-T
Equity Futures {Ex}:{Ex_UnderlyingSymbol}{YY}{MMM}FUT NSE:NIFTY20OCTFUT,
NSE:BANKNIFTY20NOVFUT
Equity Options (Monthly Expiry) {Ex}:{Ex_UnderlyingSymbol}{YY}{MMM}{Strike}{Opt_Type} NSE:NIFTY20OCT11000CE,
NSE:BANKNIFTY20NOV25000PE
Equity Options (Weekly Expiry) {Ex}:{Ex_UnderlyingSymbol}{YY}{M}{dd}{Strike}{Opt_Type} NSE:NIFTY20O0811000CE,
NSE:BANKNIFTY20N0525000PE,
NSE:NIFTY20D1025000CE
Currency Futures {Ex}:{Ex_CurrencyPair}{YY}{MMM}FUT NSE:USDINR20OCTFUT,
NSE:GBPINR20NOVFUT
Currency Options (Monthly Expiry) Ex}:{Ex_CurrencyPair}{YY}{MMM}{Strike}{Opt_Type} NSE:USDINR20OCT75CE,
NSE:GBPINR20NOV80.5PE
Currency Options (Weekly Expiry) {Ex}:{Ex_CurrencyPair}{YY}{M}{dd}{Strike}{Opt_Type} NSE:USDINR20O0875CE,
NSE:GBPINR20N0580.5PE
NSE:USDINR20D1075CE
Commodity Futures {Ex}:{Ex_Commodity}{YY}{MMM}FUT MCX:CRUDEOIL20OCTFUT,
MCX:GOLD20DECFUT
Commodity Options (Monthly Expiry) {Ex}:{Ex_Commodity}{YY}{MMM}{Strike}{Opt_Type} MCX:CRUDEOIL20OCT4000CE,
MCX:GOLD20DEC40000PE

PlaceOrder


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/PlaceOrder

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/PlaceOrder



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71",
    "data":
        {
            "strg_name": "Test Strategy",
            "symbol":"NSE:RELIANCE-EQ",
            "qty":"1",
            "type":"2",
            "side":"1",
            "productType":"INTRADAY",
            "limitPrice":0,
            "stopPrice": 0,
            "validity": "DAY",
            "disclosedQty": 0,
            "offlineOrder": "False",
            "stopLoss": 0,
            "takeProfit": 0
        }
}

Response example :

{
    "s": "error",
    "code": -174,
    "message": "RMS:1111644:NSE EQUITY 2885 RELIANCE INTRADAY  EQ XR03832 B 1 I 2368.45 MARKET IS CLOSE YOU CANNOT PLACE AN ORDER NOW",
    "id": "1111644"
}
                

REQUEST ATTRIBUTES

Attribute Data Type Description
symbol* string Eg: NSE:SBIN-EQ
qty* int
The quantity should be in multiples of lot size for derivatives.
type* int 1 => Limit Order
2 => Market Order
3 => Stop Order (SL-M)
4 => Stoplimit Order (SL-L)
side* int 1 => Buy
-1 => Sell
productType* string CNC => For equity only
INTRADAY => Applicable for all segments.
MARGIN => Applicable only for derivatives
CO => Cover Order
BO => Bracket Order
limitPrice* float Default => 0
Provide valid price for Limit and Stoplimit orders
stopPrice* float Default => 0
Provide valid price for Stop and Stoplimit orders
disclosedQty* int Default => 0
Allowed only for Equity
validity* string IOC => Immediate or Cancel
DAY => Valid till the end of the day
offlineOrder* string False => When market is open
True => When placing AMO order
stopLoss* float Default => 0
Provide valid price for CO and BO orders
takeProfit* float Default => 0
Provide valid price for BO orders

PlaceMultiOrder


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/PlaceMultiOrder

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/PlaceMultiOrder



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71",
    "data":
      {
          "orders" : 
            [
                {
                "order_refno":"1",
                "user_apikey":"c1997d92a3bb556a67dca7d1446b7087",
                "api_secret":"5306433329e81ba41203653417063c71",
                "strg_name": "Test Strategy",
                "symbol":"NSE:RELIANCE-EQ",
                "qty":"1",
                "type":"2",
                "side":"1",
                "productType":"INTRADAY",
                "limitPrice":0,
                "stopPrice": 0,
                "validity": "DAY",
                "disclosedQty": 0,
                "offlineOrder": "False",
                "stopLoss": 0,
                "takeProfit": 0
                },
                {
                "order_refno":"2",
                "strg_name": "Test Strategy",
                "user_apikey":"c1997d92a3bb556a67dca7d1446b7087",
                "api_secret":"5306433329e81ba41203653417063c71",
                "symbol":"NSE:SBIN-EQ",
                "qty":"1",
                "type":"2",
                "side":"1",
                "productType":"INTRADAY",
                "limitPrice":0,
                "stopPrice": 0,
                "validity": "DAY",
                "disclosedQty": 0,
                "offlineOrder": "False",
                "stopLoss": 0,
                "takeProfit": 0
                }
            ]
      }
}

Response example :

[
    {
        "s": "error",
        "code": -99,
        "message": "RMS:169444:NSE,EQUITY,2885,RELIANCE,INTRADAY,,EQ,XR03832,B,1,I,2380.60010,FUND LIMIT INSUFFICIENT,AVAILABLE FUND=29.33,ADDITIONAL REQUIRED FUND=446.79,CALCULATED MARGIN FOR ORDER=476.12",
        "id": "169444"
    },
    {
        "s": "error",
        "code": -99,
        "message": "RMS:169454:NSE,EQUITY,3045,SBIN,INTRADAY,,EQ,XR03832,B,1,I,437.95001,FUND LIMIT INSUFFICIENT,AVAILABLE FUND=29.33,ADDITIONAL REQUIRED FUND=58.26,CALCULATED MARGIN FOR ORDER=87.59",
        "id": "169454"
    }
]
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
order_refno Order Reference Number Yes
stgy_name Strategy Name Yes
variety NORMAL - Normal Order (Regular)
STOPLOSS - Stop loss order
AMO - After Market Order
Yes
symbol Trading Symbol Yes
exchange Exchange name Yes
transaction_type Transtaction Type Yes
duration duration - It can be one of the following
DAY
IOC
GTD
Yes
order_type Order Type - It can be one of the following
MARKET - Market Order(MKT)
LIMIT - Limit Order(L)
STOPLOSS_LIMIT - Stop Loss Limit Order(SL)
STOPLOSS_MARKET - Stop Loss Market Order(SL-M)
Yes
quantity Quantity Yes
disclosed_quantity Disclosed Quantity Yes
price Price Yes
trigger_price Trigger Price Yes
product Shows if the order was either
DELIVERY - Cash & Carry for equity (CNC)
CARRYFORWARD - Normal for futures and options (NRML)
MARGIN - Margin Delivery
AMO_MARGIN - AMO Margin
AMO_DELIVERY - AMO Delivery
AMO_CARRYFORWARD - AMO Carryforward
Yes
is_amo AMO - It can be one of the following
YES
NO
Yes

PlaceFOOptionsOrder


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/PlaceFOOptionsOrder

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/PlaceFOOptionsOrder



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b70",
    "api_secret":"5306433329e81ba41203653417063c",
    "data":
      {
        "stgy_name":"Options",
        "spot_sym":"NIFTY",
        "expiry_dt":"22D08",
        "opt_type":"PE",
        "side":"-1",
        "type":"2",
        "qty":"50",
        "limitPrice":"0",
        "stopPrice":"0",
        "productType":"MARGIN",
        "strike_int":"50",
        "offset":"-4"
      }      
}

Response example :

{
    "s": "ok",
    "code": 1101,
    "message": "Order Submitted Successfully. Your Order Ref. No.2221201528222",
    "id": "2221201528222",
    "symbol": "NSE:NIFTY22D0818600PE"
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
stgy_name Strategy Name Yes
spot_sym Trading Symbol Yes
expiry_dt Expiry Date Yes
opt_type CE
PE
Yes
side* int 1 => Buy
-1 => Sell
type* int 1 => Limit Order
2 => Market Order
3 => Stop Order (SL-M)
4 => Stoplimit Order (SL-L)
qty int The quantity should be in multiples of lot size for derivatives.
limitPrice float Default => 0
Provide valid price for Limit and Stoplimit orders
stopPrice float Default => 0
Provide valid price for Limit and Stoplimit orders
productType* string CNC => For equity only
INTRADAY => Applicable for all segments.
MARGIN => Applicable only for derivatives
CO => Cover Order
BO => Bracket Order
strike_int Strike Interval Yes
offset Off Set Yes

ModifyOrder


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/ModifyOrder

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/ModifyOrder



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b70",
    "api_secret":"5306433329e81ba41203653417063c",
    "data":
      {
        "strg_name":"Test Strategy",
        "id":809229222111,
        "qty":1,
        "type":2,
        "side":1,
        "limitPrice":61200
      }
}

Response example :

{
  "s": "ok",
  "code": 1101,
  "message": "Successfully modified order', 'id': '808058117761"
}
                

REQUEST ATTRIBUTES

Attribute Data Type Description
id* string Mandatory.
Eg: 119031547242
limitPrice float Optional. Only incase of Limit/ Stoplimit orders
stopLoss float Optional. Only incase of Stop/ Stoplimit orders
qty int Optional. Incase you want to modify the quantity
type int Optional. Incase you want to change the order type of the pending order

CancelOrder


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/CancelOrder

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/CancelOrder



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b70",
    "api_secret":"5306433329e81ba41203653417063c",
    "data":
      {
        "id":"52009227353"
      }
}

Response example :

{
  "s": "ok",
  "code": 1103,
  "message": "Successfully cancelled order",
  "id": "808058117761"
}
                

REQUEST ATTRIBUTES

Attribute Data Type Description
id* string Mandatory.
Eg: 119031547242

profile


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/profile

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/profile



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b70",
    "api_secret":"5306433329e81ba41203653417063c"
}

Result Example:

{
    "s": "ok",
    "code": 200,
    "message": "",
    "data": {
        "name": "YOUR NAME",
        "image": null,
        "display_name": null,
        "email_id": "YOUR EMAIL ID",
        "PAN": "YOUR PAN DETAILS",
        "fy_id": "YOUR CLIENT ID",
        "pwd_change_date": "03-07-2021 09:49:11",
        "pwd_to_expire": 43
    }
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
api_key Algomojo API Key Yes
api_secret Algomojo API Secret Yes

RESPONSE ATTRIBUTES

Attribute Datatype Description
fy_id string Uniquely identifies the user
name string Name of the user
email_id string E-mail address of the user
PAN string PAN Number
image string Image of the client
display_name string Name for display
pwd_change_date string Password Change Date
pwd_to_expire string Password Expires On

funds


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/funds

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/funds



Request example :

{
  "api_key":"c1997d92a3bb556a67dca7d1446b70",
  "api_secret":"5306433329e81ba41203653417063c"
}

Response example :

{
    "s": "ok",
    "code": 200,
    "message": "",
    "fund_limit": [
        {
            "id": 9,
            "title": "Limit at start of the day",
            "equityAmount": 29.33,
            "commodityAmount": 0
        },
        {
            "id": 8,
            "title": "Adhoc Limit",
            "equityAmount": 0,
            "commodityAmount": 0
        },
        {
            "id": 7,
            "title": "Receivables",
            "equityAmount": 0,
            "commodityAmount": 0
        },
        {
            "id": 6,
            "title": "Fund Transfer",
            "equityAmount": 0,
            "commodityAmount": 0
        },
        {
            "id": 5,
            "title": "Collaterals",
            "equityAmount": 0,
            "commodityAmount": 0
        },
        {
            "id": 4,
            "title": "Realized Profit and Loss",
            "equityAmount": 0,
            "commodityAmount": 0
        },
        {
            "id": 2,
            "title": "Utilized Amount",
            "equityAmount": 0,
            "commodityAmount": 0
        },
        {
            "id": 3,
            "title": "Clear Balance",
            "equityAmount": 29.33,
            "commodityAmount": 0
        },
        {
            "id": 1,
            "title": "Total Balance",
            "equityAmount": 29.33,
            "commodityAmount": 0
        },
        {
            "id": 10,
            "title": "Available Balance",
            "equityAmount": 29.33,
            "commodityAmount": 0
        }
    ]
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
api_key Algomojo API Key Yes
api_secret Algomojo API Secret Yes

RESPONSE ATTRIBUTES

Attribute Datatype Description
id int Unique identity for particular fund
title string Each title represents a heading of the ledger
equityAmount float The amount in the capital ledger for the above-mentioned title
commodityAmount float The amount in the commodity ledger for the above-mentioned title

Holdings


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/holdings

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/holdings



Request example :

{
  "api_key":"c1997d92a3bb556a67dca7d1446b70",
  "api_secret":"5306433329e81ba41203653417063c"
}

Response example:

{
    "s": "ok",
    "code": 200,
    "message": "",
    "holdings": [
        {
            "holdingType": "HLD",
            "quantity": 1,
            "costPrice": 12.4,
            "marketVal": "11.10",
            "remainingQuantity": 1,
            "pl": -1.3,
            "ltp": 11.1,
            "id": 1,
            "fyToken": "101000000011915",
            "exchange": 10,
            "symbol": "NSE:YESBANK-EQ"
        }
    ],
    "overall": {
        "count_total": 1,
        "total_investment": 12.4,
        "total_current_value": 11.1,
        "total_pl": -1.3,
        "pnl_perc": -10.4839
    }
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
api_key Algomojo API Key Yes
api_secret Algomojo API Secret Yes

RESPONSE ATTRIBUTES

Attributes Datatype Description
holdingType Identify the type of holding
symbol Shows the trading symbol. Eg: NSE:RCOM-EQ
quantity The quantity of the symbol which the user has at the beginning of the day
remainingQuantity This reflects the quantity - the quantity sold during the day
costPrice The original buy price of the holding
marketVal The Market value of the current holding
ltp LTP is the price from which the next sale of the stocks happens
fytoken Fytoken is a unique identifier for every symbol
exchange The exchange in which order is placed.
Attributes Datatype Description
count_total Total number of holdings present
total_investment Invested amount for the current holdings
total_current_value The present value of the holdings
total_pl Total profit and loss made
pnl_perc Percentage value of the total pnl

OrderBook


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/orderbook

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/orderbook



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71"
}

Response example :
{
    "s": "ok",
    "code": 200,
    "message": "",
    "orderBook": [
        {
            "orderDateTime": "20-Aug-2021 12:32:31",
            "id": "174264",
            "exchOrdId": "1300000013082682",
            "side": 1,
            "segment": 10,
            "instrument": 0,
            "productType": "CNC",
            "status": 2,
            "qty": 1,
            "remainingQuantity": 0,
            "filledQty": 1,
            "limitPrice": 0,
            "stopPrice": 0,
            "type": 2,
            "discloseQty": 0,
            "dqQtyRem": 0,
            "orderValidity": "DAY",
            "source": "ITS",
            "slNo": 1,
            "fyToken": "101000000011915",
            "offlineOrder": false,
            "message": "TRADE CONFIRMED",
            "orderNumStatus": "174264:2",
            "tradedPrice": 11.1,
            "exchange": 10,
            "pan": "YOUR PAN CARD",
            "clientId": "YOUR CLIENT ID",
            "symbol": "NSE:YESBANK-EQ",
            "ch": -0.2,
            "chp": -1.77,
            "lp": 11.1,
            "ex_sym": "YESBANK",
            "description": "YES BANK LIMITED"
        }
    ]
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
api_key Algomojo API Key Yes
api_secret Algomojo API Secret Yes

RESPONSE ATTRIBUTES

Attributes Datatype Description
id string The unique order id assigned for each order
exchOrdId string The order id provided by the exchange
symbol string The symbol for which order is placed
qty int The original order qty
remainingQuantity int The remaining qty
filledQty int The filled qty after partial trades
status int 1 => Canceled
2 => Traded / Filled
3 => (Not used currently)
4 => Transit
5 => Rejected
6 => Pending
7 => Expired
slNo int This is used to sort the orders based on the time
message string The error messages are shown here
segment int 10 => E (Equity)
11 => D (F&O)
12 => C (Currency)
20 => M (Commodity)
limitPrice float The limit price for the order
stopPrice float The stop price for the order
productType string The product type
type int 1 => Limit Order
2 => Market Order
3 => Stop Order (SL-M)
4 => Stoplimit Order (SL-L)
side int 1 => Buy
-1 => Sell
disclosedQty int Disclosed quantity
orderValidity string DAY
IOC
orderDateTime string The order time as per DD-MMM-YYYY hh:mm:ss in IST
parentId string The parent order id will be provided only for applicable orders..
Eg: BO Leg 2 & 3 and CO Leg 2
tradedPrice float The average traded price for the order
source string Source from where the order was placed.
fytoken string Fytoken is a unique identifier for every symbol.
offlineOrder string False => When market is open
True => When placing AMO order
pan string PAN of the client
clientId number The client id of the fyers user
exchange int The exchange in which order is placed
instrument int Exchange instrument type

TradeBook


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/tradebook

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/tradebook



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71"
}

Response example :

{
    "s": "ok",
    "code": 200,
    "message": "",
    "tradeBook": [
        {
            "clientId": "YOUR CLIENT CODE",
            "orderDateTime": "23-Aug-2021 11:07:33",
            "orderNumber": "162004",
            "exchangeOrderNo": "1300000010099693",
            "exchange": 10,
            "transactionType": 1,
            "segment": 10,
            "orderType": 2,
            "fyToken": "101000000011915",
            "productType": "CNC",
            "tradedQty": 1,
            "tradePrice": 10.9,
            "tradeValue": 10.9,
            "tradeNumber": "77846484",
            "id": "77846484",
            "row": 1,
            "symbol": "NSE:YESBANK-EQ"
        }
    ]
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
api_key Algomojo API Key Yes
api_secret Algomojo API Secret Yes

RESPONSE ATTRIBUTES

Attributes Datatype Description
symbol string symbol name
Eg: NSE:SBIN-EQ
id string The unique id to sort the trades
orderDateTime string The time when the trade occured in “DD-MM-YYYY hh:mm:ss” format in IST
orderNumber string The order id for which the trade occurred
tradeNumber string The trade number generated by the exchange
tradePrice float The traded price
tradeValue float The total traded value
tradedQty int The total traded qty
side int 1 => Buy
-1 => Sell
productType string The product in which the order was placed
exchangeOrderNo string The order number provided by the exchange
segment int The segment in which order is placed
exchange int The exchange in which order is placed
fyToken string Fytoken is a unique identifier for every symbol

Positions


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/positions

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/positions



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71"
}

Response example :

{
    "s": "ok",
    "code": 200,
    "message": "",
    "netPositions": [
        {
            "netQty": 1,
            "qty": 1,
            "avgPrice": 11.1,
            "netAvg": 11.1,
            "side": 1,
            "productType": "CNC",
            "realized_profit": 0,
            "unrealized_profit": 0.05,
            "pl": 0.05,
            "ltp": 11.15,
            "buyQty": 1,
            "buyAvg": 11.1,
            "buyVal": 11.1,
            "sellQty": 0,
            "sellAvg": 0,
            "sellVal": 0,
            "slNo": 0,
            "fyToken": "101000000011915",
            "dummy": "          ",
            "crossCurrency": "N",
            "rbiRefRate": 1,
            "qtyMulti_com": 1,
            "segment": 10,
            "symbol": "NSE:YESBANK-EQ",
            "id": "NSE:YESBANK-EQ-CNC"
        }
    ],
    "overall": {
        "count_total": 1,
        "count_open": 1,
        "pl_total": 0.05,
        "pl_realized": 0,
        "pl_unrealized": 0.05
    }
}
                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
api_key Algomojo API Key Yes
api_secret Algomojo API Secret Yes

RESPONSE ATTRIBUTES

Attributes Datatype Description
symbol string Symbol of the Position
id string The unique value for each position
buyAvg float Average buy price
buyQty int Total buy qty
sellAvg float Average sell price
sellQty int Total sell qty
netAvg float netAvg
netQty int Net qty
side int The side shows whether the position is long / short
qty int Absolute value of net qty
productType string The product type of the position
realized_profit float The realized p&l of the position
unrealized_profit float The unrealized p&l of the open position
pl float The total p&l of the position
crossCurrency string Y => It is cross currency position
N => It is not a cross currency position
rbiRefRate float Incase of cross currency position, the rbi reference rate will be required to calculate the p&l
qtyMulti_com float Incase of commodity positions, this multiplier is required for p&l calculation
segment int The segment in which the position is taken.
exchange int The exchange in which the position is taken.
slNo int This is used for sorting of positions
ltp float LTP is the price from which the next sale of the stocks happens
fytoken string Fytoken is a unique identifier for every symbol.
Attributes Datatype Description
count_total int Total number of positions present
count_open int Total number of positions opened
pl_total float Total profit and losses
pl_realized float Profit and losses when the owned product is sold
pl_unrealized float Profit and loses when the product is owned , but is not sold

SquareOffPosition


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/SquareOffPosition

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/SquareOffPosition



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71",
    "data":
    {
        "id" : "NSE:SBIN-EQ-BO"
    }
}

Response example :

{
    "s": "ok",
    "code": 200,
    "message": "The position is closed",
}
                

REQUEST ATTRIBUTES

Attribute Data Type Description
id string Optional
Eg: NSE:SBIN-EQ-BO
This will only exit the open positions for a particular position id

SquareOffAllPositions


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/SquareOffAllPositions

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/SquareOffAllPositions



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71"
}

Response example :

{
    "s": "ok",
    "code": 200,
    "message": "",
}
                

PartialPositionconvertion


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/PartialPositionconvertion

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/PartialPositionconvertion



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71",
    "data":
    {
      "symbol":"MCX:SILVERMIC20NOVFUT",
      "positionSide":1,
      "convertQty":1,
      "convertFrom":"INTRADAY",
      "convertTo":"CNC"
    }    
}

Response example :

 {
  "s": "ok",
  "code": 200,
  "message": "Position Converted Successfully!!",
  "positionDetails": 1101
}
                

REQUEST ATTRIBUTES

Attribute Data Type Description
symbol string Mandatory Eg:MCX:SILVERMIC20NOVFUT
positionSide int 1 => Open long positions
-1 => Open short positions
convertQty int Quantity to be converted. Has to be in multiples of lot size for derivatives
convertFrom string Existing productType
(CNC positions cannot be converted)
convertTo string The new product type

Notes
1. CNC, CO and BO positions cannot be converted.
2.You cannot convert positions to CO and BO

fetchtoken


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/fetchtoken

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/fetchtoken



Request example :

{
    "api_key":"c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71",
    "data":
        {
            "s":"RELIANCE-EQ"
        }
}

Response example :

{
    "trading_symbol": "INFY-EQ",
    "exch": "NSE",
    "token": "1594",
    "lot_size": "1",
    "fy_symbol": "NSE:INFY-EQ",
    "fy_token": "10100000001594",
    "s": "ok"
}

                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
s Symbol Name (As per Watchlist in the fy.algomojo.com) Yes

RESPONSE ATTRIBUTES

Attributes Datatype Description
token string symbol token
tradingsymbol string Trading Symbol
symbol string Symbol Name
lot_size string Lot Size of the Symbol
fy_symbol string Fyers Symbol
fy_token string Fyers Token

GetQuotes


# Here is a curl example
curl \
-X POST https://fyapi.algomojo.com/1.0/GetQuotes

                

To get characters you need to make a POST call to the following url :
https://fyapi.algomojo.com/1.0/GetQuotes



Request example :

{
    "api_key": "c1997d92a3bb556a67dca7d1446b7087",
    "api_secret":"5306433329e81ba41203653417063c71",
    "data": {
        "fy_symbol":"NSE:RELIANCE-EQ"
    }
}

Response example :

{
    "s": "ok",
    "d": [
        {
            "n": "NSE:RELIANCE-EQ",
            "s": "ok",
            "v": {
                "ch": -63.45,
                "chp": -2.64,
                "lp": 2340.45,
                "spread": 0,
                "ask": 0,
                "bid": 0,
                "open_price": 2398.05,
                "high_price": 2408,
                "low_price": 2320,
                "prev_close_price": 2403.9,
                "volume": 9714489,
                "short_name": "RELIANCE-EQ",
                "exchange": "NSE",
                "description": "NSE:RELIANCE-EQ",
                "original_name": "NSE:RELIANCE-EQ",
                "symbol": "NSE:RELIANCE-EQ",
                "fyToken": "10100000002885",
                "tt": 1639872000
            }
        }
    ]
}

                

REQUEST ATTRIBUTES

Request Parameter Description Mandatory
fy_symbol Fyers Symbol Name (As per Security Info in the fy.algomojo.com) Yes

RESPONSE ATTRIBUTES

Attributes Datatype Description
s string ok / error
ch float Change value
chp string Percentage of change between the current value and the previous day's market close
ip string Last traded price
spread float Difference between lowest asking and highest bidding price
ask float Asking price for the symbol
bid float Bidding price for the symbol
open_price float Price at market opening time
high_price float Highest price for the day
low_price float Lowest price for the day
volume int Volume traded
short_name string Short name for the symbol Eg: “SBIN-EQ”
exchange string Name of the exchange. Eg: “NSE” or “BSE”
description string Description of the symbol
original_name string Original name of the symbol name provided by the use
symbol string Symbol name provided by the user
tt int Today’s time
cmd dict Current time, open, high, low price and volume with
HH:MM timestamp