Introduction¶
SkyBroking is a collection of fast, high performing, low complexity and easy to understand trading APIs for you, the retail traders to build state of the art financial platforms which can be used for trading, investment, wealth generation, automation of trading strategies & execute algo based strategies.
It is a set of REST-like APIs that provide integration with our trading eco-system. You can Execute, Modify and Cancel Orders in real time, Manage Portfolio, access Live Market data feeds and Order status stream, view Funds & Balance, and build much more in the Capital Market space with our Open APIs.
SkyBroking APIs offer resource-based URLs that accept JSON or form-encoded requests. The response is returned as JSON-encoded by using Standard HTTP response codes unless explicitly stated otherwise. The service calls are platform independent. To Jumpstart your development, toolkits are available in several Programming languages.
Base URL¶
The Base URL is the common URL used as a prefix for all API calls.
https://skypro.skybroking.com/NorenWClientTP/
API Versions¶
The current version of the SkyBroking Open API is 1.0 and All requests go to it by default. It is recommended that a specific version be requested explicitly for production applications as major releases may break older implementations. Major changes in the API will be released with new versions.
For FinTech¶
Partner login mechanisms are on-demand APIs provided by SkyBroking to build innovative financial products to generate wealth via Investment or Trading such as Algo Trading, Portfolio Management and Trading Products
User Token¶
- length 128 bytes
- To be obtained from user. TOKEN validity will be one month
- Encrypted (CipherMode ECB, Key size 256, Block size 128)
sample Token
eg.2nd1oH8ZqSyHpbuQakxN8UxJKbV1hAbaottIfp0l/O9br +osP9nFmBQK0eurSvuIhAoivit7mNw8j2OqisUlBSZ0xhhRPYvonigZpUZ2At8G0NfBP F5I2kjW0s+vuM7t
Token Verification¶
- TOKEN to be decrypted using VENDOR KEY (already shared with Vendor)
- Decrypted TOKEN will contain "VENDOR_KEY|USER_TOKEN" seperated by pipe
-
eg. BmF8bWe27072022ASJNHK78123KJL| d9445e00af5ab3a31aa131888c343f414df3c1d5cf206eee33f 7c078dac6c655
-
Decrypted VENDOR_KEY to be verified for authentication.
- USER_TOKEN to be used henceforth for all API related calls.
Decrypt Sample Code¶
Decrypt Sample Code
using System;
using System.Security.Cryptography;
using System.Text;
private static string Decrypt(string sData, string sKey)
{
string result = "";
sKey = sKey.PadRight(32);
byte[] bData = Convert.FromBase64String(sData); byte[] bKey = Encoding.UTF8.GetBytes(sKey);
result = Convert.ToBase64String(bKey);
using (RijndaelManaged csp = new RijndaelManaged())
{
csp.KeySize = 256;
csp.BlockSize = 128;
csp.Key = bKey;
csp.Padding = PaddingMode.PKCS7;
csp.Mode = CipherMode.ECB;
ICryptoTransform decrypter = csp.CreateDecryptor();
byte[] bResult = decrypter.TransformFinalBlock(bData, 0, bData.Length); result = Encoding.UTF8.GetString(bResult);
}
return result; }
import base64
from Crypto.Cipher import AES
from Crypto.Util.Padding import pad
def decrypt_data(sKey, sData):
result = ""
sKey = sKey.ljust(32)
bData = base64.b64decode(sData)
bKey = sKey.encode('utf-8')
result = base64.b64encode(bKey).decode('utf-8')
cipher = AES.new(bKey, AES.MODE_ECB)
decrypted_data = cipher.decrypt(bData)
result = decrypted_data.decode('utf-8')
return result
sData="2nd1oH8ZqSyHpbuQakxN8fHFqQXhgzckvf9MorGNTwXm+Yil0HJ/5YVJt4Okv6VX23GoKPrum5nocsKRHnbcfKGdh7EcYXIorrgbIdc70jpW6v5WROrme3UhSoeID+Ab"
sKey="ApiLive27072022ASJNHK78123KJL"
sdec=decrypt_data(sKey,sData)
print(sdec)
For Individual Traders¶
Individual Traders can use APIs to modify, place or cancel orders on the trading platforms including various types like stop orders, market orders and limit orders. The use of APIs allows traders to perfectly time their trades to a fraction of a second, which can significantly improve results
Generate API Token¶
To use sky Broking API Token, Login to Skypro click on your profile (client code) click API key you will be redirected to API token generation page on Vendor Tab kindly select Individual [your client code] enter your password click Generate API Token
there is no encryption and decryption for individual API Token you can directly use that token as mentioned in this document