資料介紹
描述
一旦比特幣價格大幅下跌并且您首先收到通知,擁有一個個人機器人來提醒您不是很好嗎?此外,在達到一定水平后,警報會上升,表明現(xiàn)在是投資的黃金機會。
先決條件:
2.使用botfather創(chuàng)建一個電報機器人
讓我們開始吧:
1.硬件部分:
進行如圖所示的基本連接:
?

?
2.軟件部分:
登錄 linux 或使用 PuTTY 登錄 Digital Ocean 的 VPS。
conf.py
使用命令創(chuàng)建文件sudo nano
conf.py
。編寫以下代碼:
"""Configurations for alert.py"""
bolt_api_key = "XXXX" # This is your Bolt Cloud API Key
device_id = "XXXX" # This is the device ID and will be similar to BOLTXXXX where XXXX is some numbers
telegram_chat_id = "@XXXX" # This is the channel ID of the created Telegram channel. Paste after @ symbol.
telegram_bot_id = "botXXXX" # This is the bot ID of the created Telegram Bot. Paste after bot text.
threshold = 700000 # Threshold beyond which the alert should be sent
alert.py
使用命令創(chuàng)建另一個文件sudo nano
alert.py
。編寫以下代碼:
import requests, time, json, conf
from boltiot import Bolt
mybolt = Bolt(conf.bolt_api_key, conf.device_id)
def get_bitcoin_price():
URL = "https://min-api.cryptocompare.com/" # REPLACE WITH CORRECT URL
response = requests.request("GET", URL)
response = json.loads(response.text)
current_price = response["INR"]
return current_price
def send_telegram_message(message):
"""Sends message via Telegram"""
url = "https://api.telegram.org/" + conf.telegram_bot_id + "/sendMessage"
data = {
"chat_id": conf.telegram_chat_id,
"text": message
}
try:
response = requests.request(
"POST",
url,
params=data
)
print("This is the Telegram URL")
print(url)
print("This is the Telegram response")
print(response.text)
telegram_data = json.loads(response.text)
return telegram_data["ok"]
except Exception as e:
print("An error occurred in sending the alert message via Telegram")
print(e)
return False
while True:
current_price = get_bitcoin_price()
if current_price <= conf.threshold:
print("Bitcoin has exceeded threshold")
message = "Alert! The current Bitcoin Price is " + str(current_price)
telegram_status = send_telegram_message(message)
response = mybolt.digitalWrite('0', 'HIGH')
print(response)
time.sleep(5)
response = mybolt.digitalWrite('0', 'LOW')
time.sleep(10)
該程序的作用是在價格低于閾值時觸發(fā)警報并發(fā)送電報通知。
3.輸出
?

?

?
- 使用Bolt IoT和ML的光學編碼器
- 使用Bolt IoT的加密貨幣通知系統(tǒng)
- 比特幣電子郵件通知程序
- 基于Bolt WIFI模塊的溫度報警器 0次下載
- 使用Bolt IOT的報警系統(tǒng)
- 使用Bolt IOT的帶有消息警報的燈光監(jiān)控系統(tǒng)
- 使用Bolt IOT的閱讀燈
- BOLT IOT補水提醒
- 通過電報和蜂鳴器發(fā)出溫度警報
- 使用BOLT Wifi模塊制作的室溫蜂鳴器
- BOLT IOT溫度報警器開源分享
- 使用Bolt IoT的鬧鐘
- 用BOLT IOT CLOUD制作比特幣價值更新器
- 使用BOLT IOT和Telegram分享市場警報
- 基于比特幣交易數(shù)據(jù)的增量聚類方法 14次下載
- 什么是比特幣與區(qū)塊鏈 3838次閱讀
- 比特幣的密碼學基礎(chǔ)詳細解析 9030次閱讀
- 比特幣到底有多少?2100萬枚比特幣挖完了之后應該怎么辦 9997次閱讀
- 比特幣和挖礦的關(guān)系及挖礦原理解析 1.5w次閱讀
- 比特幣的10個基本工作原理解釋 1.5w次閱讀
- 怎樣采用比特幣挖礦? 2768次閱讀
- 一文教你怎樣購買比特幣 1.5w次閱讀
- 怎樣將比特幣轉(zhuǎn)換為以太坊? 9021次閱讀
- 揭秘黑客如何破解比特幣錢包 2.1w次閱讀
- 比特幣和區(qū)塊鏈的學術(shù)譜系 3246次閱讀
- 比特幣是不是電子貨幣_比特幣怎么交易 1w次閱讀
- 一個比特幣要挖多長時間_比特幣挖礦耗電量驚人的原因竟是它 7.6w次閱讀
- 對于比特幣基礎(chǔ)問題的詳細剖析 3479次閱讀
- 比特幣交易平臺排名情況 1.4w次閱讀
- 比特幣區(qū)塊鏈詳解 2753次閱讀
下載排行
本周
- 1DD3118電路圖紙資料
- 0.08 MB | 1次下載 | 免費
- 2AD庫封裝庫安裝教程
- 0.49 MB | 1次下載 | 免費
- 3PC6206 300mA低功耗低壓差線性穩(wěn)壓器中文資料
- 1.12 MB | 1次下載 | 免費
- 4網(wǎng)絡安全從業(yè)者入門指南
- 2.91 MB | 1次下載 | 免費
- 5DS-CS3A P00-CN-V3
- 618.05 KB | 1次下載 | 免費
- 6海川SM5701規(guī)格書
- 1.48 MB | 次下載 | 免費
- 7H20PR5電磁爐IGBT功率管規(guī)格書
- 1.68 MB | 次下載 | 1 積分
- 8IP防護等級說明
- 0.08 MB | 次下載 | 免費
本月
- 1貼片三極管上的印字與真實名稱的對照表詳細說明
- 0.50 MB | 103次下載 | 1 積分
- 2涂鴉各WiFi模塊原理圖加PCB封裝
- 11.75 MB | 89次下載 | 1 積分
- 3錦銳科技CA51F2 SDK開發(fā)包
- 24.06 MB | 43次下載 | 1 積分
- 4錦銳CA51F005 SDK開發(fā)包
- 19.47 MB | 19次下載 | 1 積分
- 5PCB的EMC設計指南
- 2.47 MB | 16次下載 | 1 積分
- 6HC05藍牙原理圖加PCB
- 15.76 MB | 13次下載 | 1 積分
- 7802.11_Wireless_Networks
- 4.17 MB | 12次下載 | 免費
- 8蘋果iphone 11電路原理圖
- 4.98 MB | 6次下載 | 2 積分
總榜
- 1matlab軟件下載入口
- 未知 | 935127次下載 | 10 積分
- 2開源硬件-PMP21529.1-4 開關(guān)降壓/升壓雙向直流/直流轉(zhuǎn)換器 PCB layout 設計
- 1.48MB | 420064次下載 | 10 積分
- 3Altium DXP2002下載入口
- 未知 | 233089次下載 | 10 積分
- 4電路仿真軟件multisim 10.0免費下載
- 340992 | 191390次下載 | 10 積分
- 5十天學會AVR單片機與C語言視頻教程 下載
- 158M | 183342次下載 | 10 積分
- 6labview8.5下載
- 未知 | 81588次下載 | 10 積分
- 7Keil工具MDK-Arm免費下載
- 0.02 MB | 73815次下載 | 10 積分
- 8LabVIEW 8.6下載
- 未知 | 65989次下載 | 10 積分
評論