Skip to content

kolliderhq/kollider-api-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

πŸ€– Kollider API Client written in Python πŸ€–

Kollider offers both a REST api as well as a Websocket api. Both apis provide the same basic accessor methods, however, account specific events are only available through websockets and historical data is only available through rest. We are working towards making them identical.

You can install the client package in your environment by running.

cd kollider-api-client
pip install -e .

Example usage for subscribing to the .BTCUSD index pice:

from kollider_api_client.ws import KolliderWsClient
import json

BASE_URL = "wss://api.kollider.xyz/v1/ws/"

class WSClient(KolliderWsClient):

    ws_is_ready = False

    def on_message(self, _ctx, msg):
        msg = json.loads(msg)
        t = msg["type"]
        data = msg["data"]

        if t == "index_values":
            print(data)

    def on_open(self, event):
        self.ws_is_ready = True


if __name__ in "__main__":

    ws_client = WSClient()
    ws_client.connect(base_url=BASE_URL)

    while not ws_client.ws_is_ready:
        pass

    ws_client.sub_index_price([".BTCUSD"])

    while True:
        pass

πŸ“• The docs can be found here.

TODO:

  • Error Handling
  • Add missing methods (see docs)

Note: Not all methods have been implemented yet. This is very much a WIP.

About

Rest and Ws client to the Kollider API.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages