Skip to main content

FastConnect Data client by Python

Project description

Semantic Release

Installation

From tar ball (most stable)

If you download file fc-data.py.zip, we include tarball file:

pip install dist/ssi-fc-data-2.1.0.tar.gz

Install behind proxy

pip install --trusted-host pypi.org --trusted-host
files.pythonhosted.org --proxy=http://<username>:<password>@<host>:<port> ssi-fc-data

Or

pip install --trusted-host pypi.org --trusted-host
files.pythonhosted.org --proxy=http://<username>:<password>@<host>:<port> dist/ssi-fc-data-2.1.0.tar.gz

Pypi

pip install ssi-fc-data

Sample usage

Config

Get consumerID and consumerSecret from iBoard

auth_type = 'Bearer'
consumerID = ''
consumerSecret = ''

url = 'https://fc-data.ssi.com.vn/'
stream_url = 'https://fc-data.ssi.com.vn/'

API

from ssi_fc_data import fc_md_client , model
import config


client = fc_md_client.MarketDataClient(config)
def md_get_securities_list():
    req = model.securities('HNX', 1, 100)
    print(client.securities(config, req))

def md_get_securities_details():
    req = model.securities_details('HNX', 'ACB', 1, 100)
    print(client.securities_details(config, req))

def main():
    
    md_get_securities_list()
    md_get_securities_details()
        

if __name__ == '__main__':
	main()

Streaming Data

# import ssi_fc_data
import config
import json
from ssi_fc_data.fc_md_stream import MarketDataStream
from ssi_fc_data.fc_md_client import MarketDataClient



#get market data message
def get_market_data(message):
	print(message)


#get error
def getError(error):
	print(error)


#main function
def main():


	selected_channel = input("Please select channel: ")
	mm = MarketDataStream(config, MarketDataClient(config))
	mm.start(get_market_data, getError, selected_channel)
	message = None
	while message != "exit()":
		message = input(">> ")
		if message is not None and message != "" and message != "exit()":
			mm.swith_channel(message)
	


main()

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ssi_fc_data-2.2.0.tar.gz (11.7 kB view details)

Uploaded Source

File details

Details for the file ssi_fc_data-2.2.0.tar.gz.

File metadata

  • Download URL: ssi_fc_data-2.2.0.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.9.6 readme-renderer/40.0 requests/2.31.0 requests-toolbelt/1.0.0 urllib3/2.0.4 tqdm/4.65.0 importlib-metadata/6.8.0 keyring/24.2.0 rfc3986/2.0.0 colorama/0.4.6 CPython/3.10.12

File hashes

Hashes for ssi_fc_data-2.2.0.tar.gz
Algorithm Hash digest
SHA256 96f0905ad778210dcf6dc8a56b0f712a2b1b2ddc45ba5f57a600ac0018a542b3
MD5 5e286de7a1f8ab94a9cac2a1a1ce3746
BLAKE2b-256 c4b0abac0fb27ce18175b523c500a0fa5b71fcdd08a7dc4b766809d7d7fc9a04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page