The Foundation of Algo-Trading
Before you can automate a strategy on FollowMe or any other platform, you need a reliable data feed. Visual charts are great for humans, but your algorithms need raw numbers—JSON data delivered via HTTP.
The "Query" Challenge
Advanced APIs often require you to send specific parameters to filter data (e.g., requesting only the last 2 candles of Gold). This is often done by embedding a JSON object into the URL. If you look at the code below, the test_url1 contains a long string starting with %7B. This is simply the machine-readable version of the configuration comments above it.
Python Implementation
Here is a functional script to pull the latest price action for USDJPY.
Python
import time
import requests # pip3 install requestsimport json
# Extra headers
test_headers = {
'Content-Type' : 'application/json'
}
'''
github: https://github.com/alltick/rea...
Register for token: https://alltick.co/register
Website: https://alltick.co
code: Please check the code list to select the code you want to query
kline_type: kline type, 1 for 1-min K, 2 for 5-min K, 3 for 15-min K, 4 for 30-min K, 5 for 1-hour K, 6 for 2-hour K, 7 for 4-hour K, 8 for daily K, 9 for weekly K, 10 for monthly K
query_kline_num: number of klines to query, max 1000
URL encode the following JSON and paste it into the query field of the http query string
{"trace" : "python_http_test1","data" : {"code" : "USDJPY","kline_type" : 1,"kline_timestamp_end" : 0,"query_kline_num" : 2,"adjust_type": 0}}
{"trace" : "python_http_test2","data" : {"symbol_list": [{"code": "GOLD"}]}}
{"trace" : "python_http_test3","data" : {"symbol_list": [{"code": "GOLD"}]}}
'''
test_url1 = 'https://quote.aatest.online/qu...
resp1 = requests.get(url=test_url1, headers=test_headers)
# Decoded text returned by the request
text1 = resp1.text
print(text1)
From Code to Signal
Once you receive text1, you parse it to get the latest Close price. If Close > Open, your bot triggers a buy; otherwise, it sells. This simple script is the cornerstone of automated execution.

Tuyên bố miễn trừ trách nhiệm: Quan điểm được trình bày hoàn toàn là của tác giả và không đại diện cho quan điểm chính thức của Followme. Followme không chịu trách nhiệm về tính chính xác, đầy đủ hoặc độ tin cậy của thông tin được cung cấp và không chịu trách nhiệm cho bất kỳ hành động nào được thực hiện dựa trên nội dung, trừ khi được nêu rõ bằng văn bản.

Để lại tin nhắn của bạn ngay bây giờ