For years, developers have relied on Yahoo Finance for quick access to market data. It was free, easy to use, and worked well for prototypes. I’ve used it myself in side projects, backtesting tools, and even dashboards.
But let’s be honest — Yahoo Finance API isn’t what it used to be. It’s unofficial, unstable, and limited in scope. At some point, you realize it’s time to move on.
That’s when I started looking for a better option. Something reliable. Something real-time. Something that works across markets — not just U.S. stocks.
I eventually landed on AllTick API, and I think it’s worth sharing why it has become my go-to alternative.
Why Yahoo Finance Isn’t Enough Anymore
First, the obvious: Yahoo’s public API has long been shut down. What you’re using today — if you’re still using it — is a workaround. It can break anytime. And even when it works, you’re limited to delayed quotes and U.S. stock data.
There’s no real support. No guarantees. And certainly not something I’d build a production system on.
What Developers Actually Need
If you're building any serious trading tool, portfolio tracker, or signal engine, here’s what you probably care about:
- Real-time market data (not 15 minutes delayed)
- Support for multiple markets: not just U.S. stocks, but also China A-shares, Hong Kong stocks, forex, crypto, and maybe even commodities
- Reliable and fast APIs — ideally both HTTP and WebSocket
- Clear docs and easy integration
- Commercial usage without worrying about licensing
- Yahoo can’t do that. That’s where AllTick comes in.
Meet AllTick API
AllTick is a real-time market data provider designed for developers. It gives you fast, stable access to financial markets across the globe.
Here’s what it covers:
China A-shares
- Hong Kong stocks
- U.S. stocks
- Forex
- Cryptocurrencies
- Commodity futures
You can query data using HTTP RESTful API, or set up WebSocket streams for real-time updates. It’s straightforward to integrate, and the latency is low enough for serious use cases — like algo trading or high-frequency analytics.
One thing to note: AllTick focuses on market quotes. You won’t find financial statements or fundamentals here — it’s purely market data. That’s exactly what I wanted, so no complaints.
AllTick vs Yahoo Finance API — A Quick Look
Example Use Cases
To give you an idea, here’s how I’ve been using AllTick:
- Real-time stock price alerts via WebSocket
- Forex market dashboard with streaming quotes
- Backtesting strategies on U.S. and Hong Kong stocks using tick data
Setting up the API was quick. The docs are clear. You get an API key, make a few HTTP calls, and you’re in.
Here’s a super basic example in Python:
import time
import requests # pip3 install requests
import json
# Extra headers
test_headers = {
'Content-Type' : 'application/json'
}
'''
Encode the following JSON with URL encoding and copy it to the "query" field in the query string of an HTTP request.
{"trace" : "python_http_test1","data" : {"code" : "700.HK","kline_type" : 1,"kline_timestamp_end" : 0,"query_kline_num" : 2,"adjust_type": 0}}
{"trace" : "python_http_test2","data" : {"symbol_list": [{"code": "700.HK"},{"code": "UNH.US"}]}}
{"trace" : "python_http_test3","data" : {"symbol_list": [{"code": "700.HK"},{"code": "UNH.US"}]}}
'''
test_url1 = 'http://quote.aatest.online/quote-stock-b-api/kline?token=e945d7d9-9e6e-4721-922a-7251a9d311d0-1678159756806&query=%7B%22trace%22%20%3A%20%22python_http_test1%22%2C%22data%22%20%3A%20%7B%22code%22%20%3A%20%22700.HK%22%2C%22kline_type%22%20%3A%201%2C%22kline_timestamp_end%22%20%3A%200%2C%22query_kline_num%22%20%3A%202%2C%22adjust_type%22%3A%200%7D%7D'
test_url2 = 'http://quote.aatest.online/quote-stock-b-api/depth-tick?token=e945d7d9-9e6e-4721-922a-7251a9d311d0-1678159756806&query=%7B%22trace%22%20%3A%20%22python_http_test2%22%2C%22data%22%20%3A%20%7B%22symbol_list%22%3A%20%5B%7B%22code%22%3A%20%22700.HK%22%7D%2C%7B%22code%22%3A%20%22UNH.US%22%7D%5D%7D%7D'
test_url3 = 'http://quote.aatest.online/quote-stock-b-api/trade-tick?token=e945d7d9-9e6e-4721-922a-7251a9d311d0-1678159756806&query=%7B%22trace%22%20%3A%20%22python_http_test3%22%2C%22data%22%20%3A%20%7B%22symbol_list%22%3A%20%5B%7B%22code%22%3A%20%22700.HK%22%7D%2C%7B%22code%22%3A%20%22UNH.US%22%7D%5D%7D%7D'
resp1 = requests.get(url=test_url1, headers=test_headers)
time.sleep(1)
resp2 = requests.get(url=test_url2, headers=test_headers)
time.sleep(1)
resp3 = requests.get(url=test_url3, headers=test_headers)
# Decoded text returned by the request
text1 = resp1.text
print(text1)
text2 = resp2.text
print(text2)
text3 = resp3.text
print(text3)
And if you’re into WebSockets:
import json
import websocket # pip install websocket-client
class Feed(object):
def __init__(self):
self.url = 'wss://quote.aatest.online/quote-stock-b-ws-api?token=e945d7d9-9e6e-4721-922a-7251a9d311d0-1678159756806'
self.ws = None
def on_open(self, ws):
"""
Callback object which is called at opening websocket.
1 argument:
@ ws: the WebSocketApp object
"""
print('A new WebSocketApp is opened!')
sub_param = {
"cmd_id": 22002,
"seq_id": 123,
"trace":"3baaa938-f92c-4a74-a228-fd49d5e2f8bc-1678419657806",
"data":{
"symbol_list":[
{
"code": "700.HK",
"depth_level": 5,
},
{
"code": "UNH.US",
"depth_level": 5,
}
]
}
}
sub_str = json.dumps(sub_param)
ws.send(sub_str)
print("depth quote are subscribed!")
def on_data(self, ws, string, type, continue_flag):
"""
4 argument.
The 1st argument is this class object.
The 2nd argument is utf-8 string which we get from the server.
The 3rd argument is data type. ABNF.OPCODE_TEXT or ABNF.OPCODE_BINARY will be came.
The 4th argument is continue flag. If 0, the data continue
"""
def on_message(self, ws, message):
"""
Callback object which is called when received data.
2 arguments:
@ ws: the WebSocketApp object
@ message: utf-8 data received from the server
"""
result = eval(message)
print(result)
def on_error(self, ws, error):
"""
Callback object which is called when got an error.
2 arguments:
@ ws: the WebSocketApp object
@ error: exception object
"""
print(error)
def on_close(self, ws, close_status_code, close_msg):
"""
Callback object which is called when the connection is closed.
2 arguments:
@ ws: the WebSocketApp object
@ close_status_code
@ close_msg
"""
print('The connection is closed!')
def start(self):
self.ws = websocket.WebSocketApp(
self.url,
on_open=self.on_open,
on_message=self.on_message,
on_data=self.on_data,
on_error=self.on_error,
on_close=self.on_close,
)
self.ws.run_forever()
if __name__ == "__main__":
feed = Feed()
feed.start()
Getting Started
You can sign up and get an API key right away. There’s a free trial tier if you just want to try it out. The docs cover everything — HTTP endpoints, WebSocket structure, market codes, etc.
They also support Python and JavaScript pretty well, so you won’t be fighting the API like some of the older data providers.
Final Thoughts
If you’ve outgrown Yahoo Finance — or just want something faster, more stable, and developer-friendly — give AllTick a try.
It won’t give you financial statements or dividend history, but for real-time quotes across multiple markets, it’s a solid upgrade.
And most importantly, it feels like an API built for developers, not just something bolted onto a website.
Top comments (0)