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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file settlesdk-0.0.7.tar.gz.

File metadata

  • Download URL: settlesdk-0.0.7.tar.gz
  • Upload date:
  • Size: 4.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for settlesdk-0.0.7.tar.gz
Algorithm Hash digest
SHA256 1f8f32155d1074587bbe0883b67c2fcf4df15d7f4982d129fbc9e1a89124ed26
MD5 62c79fca48e3fc0d0dd288a364975e72
BLAKE2b-256 363e5c19311065bd94f96b959494e8cc2f27a4985c7367d4adbea8f1bb7da3df

See more details on using hashes here.

File details

Details for the file settlesdk-0.0.7-py3-none-any.whl.

File metadata

  • Download URL: settlesdk-0.0.7-py3-none-any.whl
  • Upload date:
  • Size: 5.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.18.4 setuptools/40.6.2 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.7

File hashes

Hashes for settlesdk-0.0.7-py3-none-any.whl
Algorithm Hash digest
SHA256 efdad805e878d1e4098c9cc32b56bbe3be6182629e263f074db06063e16a64af
MD5 216a01c5e121ec1b11c1ea51b5970836
BLAKE2b-256 e73dc9e0a97255bd0937a58521e14ff452ff6de7a2dd770edb89c79a0793c4df

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