Skip to main content

The Settle SDK abstracts using the price feed and settle API by wrapping authentication in a function.

Project description

Settle SDK

The Settle SDK abstracts using the price feed and settle API by wrapping authentication in a function.

Documentation

Support channel

pip install settlesdk

Versions

0.0.4v Fixed GUID from Token 0.0.7v Fixed GUID to Username

How it works

Instead of authenticating and running requests yourself, use the settle object to run api functions.

For example

from settlesdk import PriceList
pricelist = PriceList()
coins = pricelist.ticker({'id': 1})

Important - Authentication

You need to register an app in settle in order to use the API. Head over to https://settle.finance/app/developer-tools and join our developer program.

Alt text

Set an app name and grab the automatically generated API keys. Update your .env file in your projects root so that SETTLE_API_KEY and SETTLE_API_SECRET reflect your keys. If your app doesn't use environment variables yet, you will need to setup a loader like dotenv.

SETTLE_API_KEY    = "API KEY HERE"
SETTLE_API_SECRET = "API SECRET HERE"

You can now access the Settle SDK!

Testing user specific endpoints

You can access the price feed API, but to access a users portfolio they need to install your app and opt into providing their data to you.

In your developer tools, https://settle.finance/app/developer-tools, select "portfolio" in data access permissions and click the install button to try opting into your app before it's available in the app store.

API reference

User specific apps

When your app or chat plugin is loaded inside of settle, we will pass a user_id get param (?user_id) along with the app mode (?mode).

Exchange token for a user id

from settlesdk import User
user = User()
user.exchangeTokenForGuid({'token': token})

Examples

Return ticker information about Bitcoin

from settlesdk import PriceFeed
pricefeed = PriceFeed()
pricefeed.ticker({'token': token})

Convert a GUID to a username

from settlesdk import User
user = User()
user.guid_to_username({'token': token})

Send an custom hub event

from settlesdk import Chat
chat = Chat()
chat.sendEvent({ chatId, message })

Send a notification to a user

from settlesdk import App
app = App()
app.send_notification({guid: guid})

Return a users holdings with a list of trades for each asset

from settlesdk import Portfolio
portfolio = Portfolio()
portfolio.HoldingsWithTrades({ 'guid': user_id })

Return a list of users who installed my app

from settlesdk import App
app = App()
app.users()

Send Notification to users with installed app

from settlesdk import App
app = App()
users = app.users()
for user in users:
    app.send_notification({'guid': user.guid})

Return Requests response with data

from settlesdk import App
app = App()
users, response = app.user(include_response=True)
print(response.status_code)

Project details


Download files

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

Files for settlesdk, version 0.0.7
Filename, size File type Python version Upload date Hashes
Filename, size settlesdk-0.0.7-py3-none-any.whl (5.5 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size settlesdk-0.0.7.tar.gz (4.7 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page