Skip to content

Instantly share code, notes, and snippets.

View coinscious-io's full-sized avatar

coinscious-io

View GitHub Profile
@coinscious-io
coinscious-io / new_jwt_token.py
Created August 2, 2019 18:28
How to get your JWT token
import requests
url = "https://auth-api.coinscious.org/auth/access-token"
payload = "{\n \"handle\": \"<username>\",\n \"password\": \"<password>\"\n}"
headers = {
'Content-Type': "application/json"
}
response = requests.request("POST", url, data=payload, headers=headers)
@coinscious-io
coinscious-io / new_jwt_token.java
Created August 2, 2019 18:27
How to get your JWT token
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse("application/json");
RequestBody body = RequestBody.create(mediaType, "{\n \"handle\": \"<username>\",\n \"password\": \"<password>\"\n}");
Request request = new Request.Builder()
.url("https://auth-api.coinscious.org/auth/access-token")
.post(body)
.addHeader("Content-Type", "application/json")
.build();
@coinscious-io
coinscious-io / new_jwt_token.sh
Last active August 2, 2019 18:27
How to get your JWT token
curl -X POST \
https://auth-api.coinscious.org/auth/access-token \
-H 'Content-Type: application/json' \
-d '{
"handle": "<username>",
"password": "<password>"
}'
@coinscious-io
coinscious-io / live_stream_order_book_data.java
Last active August 2, 2019 18:30
Subscribing to live stream order book data
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import java.util.concurrent.TimeUnit;
public class Example {
@coinscious-io
coinscious-io / live_stream_order_book_data.py
Last active August 2, 2019 18:30
Subscribing to live stream order book data
import websocket
try:
import
thread
except ImportError:
import _thread as thread
import time
def on_message(ws, message):
print(message)
@coinscious-io
coinscious-io / live_stream_trade_history.py
Last active August 2, 2019 18:29
Subscribing to live stream trade history data
import websocket
try:
import thread
except ImportError:
import _thread as thread
import time
def on_message(ws, message):
print(message)
@coinscious-io
coinscious-io / live_stream_trade_history.java
Last active August 2, 2019 18:30
Subscribing to live stream trade history data
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import okhttp3.WebSocket;
import okhttp3.WebSocketListener;
import java.util.concurrent.TimeUnit;
public class Example {
@coinscious-io
coinscious-io / get_vwap.sh
Created August 2, 2019 14:33
Get the VWAP of a cryptocurrency denominated in a fiat currency
curl -X GET \
'https://api.coinscious.org/vwap/btc?fiat=CAD' \
-H 'Authorization: Bearer <token>'
@coinscious-io
coinscious-io / get_vwap.py
Last active August 2, 2019 18:31
Get the VWAP of a cryptocurrency denominated in a fiat currency
import requests
url = "https://api.coinscious.org/vwap/btc"
querystring = {"fiat":"CAD”}
payload = ""
headers = {
'Authorization': "Bearer <token>"
}
@coinscious-io
coinscious-io / get_vwap.java
Created August 2, 2019 14:32
Get the VWAP of a cryptocurrency denominated in a fiat currency
import okhttp3.Dispatcher;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.Response;
import java.io.IOException;
public class Example {
public static void main(String[] args) throws IOException {