Bài đăng

Đang hiển thị bài đăng từ Tháng 5, 2022

Crypto APIs with Python

Hình ảnh
crypto API with python Crypto API with Python API list Trading view: Coingecko: API doc , my post Coin market cap: API doc , video tutorial , unsupported historical price query for free account Yahoo finance: API doc Crypto Fear and Greed Index: API doc , video tutorial , my post Rich address BTC. Tokenview , stack exchange BTC explorer: Binance API: Technical analysis: doc , video Experiment 10. MINA DCA simulation

Plot Cypto Fear and Greed index with Python API

Hình ảnh
Plot Cypto Fear and Greed index with Python API Fear and greed index with Python API # STEP 1. get BTC price from datetime import datetime import pandas as pd import requests from typing import * import time class BinanceClient : def __init__ ( self , futures = False ) : self . exchange = "BINANCE" self . futures = futures if self . futures : self . _base_url = "https://fapi.binance.com" else : self . _base_url = "https://api.binance.com" self . symbols = self . _get_symbols ( ) def _make_request ( self , endpoint : str , query_parameters : Dict ) : try : response = requests . get ( self . _base_url + endpoint , params = query_parameters ) except Exception as e : print ( "Connection error while making request to %s: %s" , endpoint , e ) re...

zkApps of Mina

Hình ảnh
 zkApps of Mina zkApps are Ethereum smart contract equivalence for Mina using zk-proof technology. Some zkApps: zkApps for mina: Website , news "metamask" of mina, zk rollup for mina MinaSnap : a metamask-like wallet for Mina MinaFT zk-Rollup SnarkyNet Minataur   Dali:  integrate Mina smart contracts with off-chain storage on FileCoin, Mina proofs are small and easy to verify; this means that any Turing complete blockchain (like Ethereum). =nil; Foundation is working on this topic by using bridge contract. (cited from Mina docs ) Mina-Ethereum bridge : We can put the entire Mina block chain onto Ethereum, so that "It will be possible to bring everything that happens inside of the Mina chain to Ethereum, including financial applications, provable computations, and much more. " Wrapped Mina on Ethereum  WMINA (a simple bridge contract) Implementation of MINA in Rust: ChainSafe github   Mina community for technology Mina black list Snarky: What is a zkApp: ...

MINA DCA simulation

Hình ảnh
mina_dca MINA DCA # STEP 0. install coingecko API # !pip install pycoingecko # STEP 1. get data from API from pycoingecko import CoinGeckoAPI cg = CoinGeckoAPI ( ) data = cg . get_coin_ohlc_by_id ( id = "mina-protocol" , vs_currency = "usd" , days = "max" ) # STEP 2. convert data to numpy array import numpy as np data = np . array ( data ) day_range = 4 * np . arange ( - data . shape [ 0 ] + 1 , 1 ) def get_mean ( price ) : n = len ( price ) mean = price [ 0 ] mean_list = [ mean ] for k in range ( n -1 ) : mean = ( k + 1 ) / ( k / mean + 1 / price [ k + 1 ] ) mean_list += [ mean ] mean_np = np . array ( mean_list ) return mean_np price = data [ : , - 1 ] mean = get_mean ( price ) import matplotlib . pyplot as plt import seaborn as sns # sns.set_style("whitegrid") sns . set_theme ( ) f , axs = plt . subplots ( 1 , ...

Coingecko Python API

Hình ảnh
 Coingecko Python API SOURCE: API list , Github For Jupyter Notebook, use the following demo code !pip install pycoingecko from pycoingecko import CoinGeckoAPI cg = CoinGeckoAPI() cg.get_price(ids= 'bitcoin' , vs_currencies= 'usd' ) btc = cg.get_coin_history_by_id(id= "bitcoin" , date= "15-01-2019" ) btc[ "market_data" ][ "current_price" ][ "usd" ] # STEP 0. install coingecko API !pip install pycoingecko #only for jupyter notebook # STEP 1. get data from API from pycoingecko import CoinGeckoAPI cg = CoinGeckoAPI() data = cg.get_coin_ohlc_by_id(id="mina-protocol", vs_currency="usd", days=365) # STEP 2. convert data to numpy array import numpy as np data = np.array(data) # STEP 3. Plot import plotly.graph_objects as go import pandas as pd from datetime import datetime df = pd.read_csv('https://raw.githubusercontent.com/plotly/datasets/master/finance-charts-apple.csv') fig = go...