Telegram Mail Interface V200 Python
Before you can send messages to yourself, you need to send a /start message to your robot in Telegram, otherwise the robot will not be able to send you messages. Email [email protected] Telegram FawkesPan Accept policy…
Telegram APIInterface (FMZ.com)
This Library Can Only Send Messages via Telegram for Now, More Features Will Be Added Later.
Initialize
# key is Bot key
## To obtain Bot key, please refer to https://www.ccino.org/create-a-telegram-bot.html
# chat_id For receiving usersTelegram ID
## Telegram ID It can be obtained through the @dwx_aibot robot. After connecting to this robot, send /getid to obtain it. ChatID
Telegram = ext.Telegram(key=string, chat_id=integer) # Create a new interface object
Send mail
# chat_id Optional, by default will use the settings at initializationChatID
# message Is the information content
Telegram.Send(message=string, chat_id=integer)
Notes
Before you can send messages to yourself, you need to send a /start message to your robot in Telegram, otherwise the robot will not be able to send you messages.
Contact me
Email [email protected] Telegram FawkesPan
Accept policy customization
About this library
Parameters
| Name | Default | What it controls |
|---|---|---|
| DEBUG | 0 | DEBUGMode: 0 | 1 |
| KEY | Telegram robot Key | |
| CHATID | false | Telegram session ID |
Source Python
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# encoding: utf-8
#
# Telegram Interface for FMZ.com
#
# Copyright 2018 FawkesPan
# Contact : [email protected] / Telegram@FawkesPan
#
# Do What the Fuck You Want To Public License
#
try:
import requests
except:
print('Requests not installed. Try: pip install requests')
Log('Requests not installed. Try: pip install requests')
raise Exception('Requests not installed. Try: pip install requests')
class Telegram:
def __init__(self):
self.key = KEY
self.chat_id = CHATID
self.url = 'https://api.telegram.org/bot%s' % self.key
def Send(self, message='', chat_id=None):
if chat_id is None:
chat_id = self.chat_id
PARAM = {}
PARAM['chat_id'] = chat_id
PARAM['text'] = message
PARAM['parse_mode'] = 'markdown'
URL = self.url + '/sendMessage'
try:
res = requests.post(URL, data = PARAM)
return True
except IOError as e:
print(e)
return False
ext.Telegram = Telegram
# Module Function Test
def main():
if DEBUG == 1:
msger = ext.Telegram(KEY, CHATID)
msger.Send("Hello World!")
return TruePublished by FawkesPan on the FMZ strategy square · last modified 2019-05-16. Collected in the Quant Trading Vault. Unvalidated research: re-test with your own data and costs before trusting it.
Build this with AgenKit
A spec is not a trading system. Paste this into your coding agent and AgenKit runs a specialist team — architecture, test-first build, risk gates, review — with paper trading on by default.
/agenkit build a production-grade trading bot with a backtest engine, risk controls and paper trading by default from strategies/Telegram-Mail-Interface-V200-Python.md- npx agenkit install engineering-kit in your project
- Paste the command into your agent and approve each phase
- Get tests, backtest, risk controls and a paper-trading switch
Understand it first
Before you run this, read the lesson behind the idea and how to backtest it honestly. Specs like this one are the survivors of an unknown number of trials; deflate their results accordingly.
Related specs
- Dynamic Balancing Strategy Python VersionPython · Other
- Exchange Wash Trading and Mutual BrushingPython · Other
- Leek Protection Program Tang Anqi Channel Position Balancing StrategyPython · Other
- Paul The Gambler Lévy Gold EditionPython · Other
- Porting OKCoin Leek Harvester Multi Variety Version Annotated Python VersionPython · Other
- Python Example Using asyncio http to Obtain Market DataPython · Other