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.

Source Distribution

settlesdk-0.0.7.tar.gz (4.7 kB view hashes)

Uploaded Source

Built Distribution

settlesdk-0.0.7-py3-none-any.whl (5.5 kB view hashes)

Uploaded Python 3

Supported by

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