Files
worldquant-alpha-system/backend/tests/research_metadata_fake.py
T

45 lines
1.4 KiB
Python
Raw Normal View History

"""Synthetic research metadata for browser acceptance; no real network."""
import httpx
from .catalog_fake import platform_response
def response(request):
if request.url.path == "/operators":
return httpx.Response(
200,
json=[
{
"name": "rank",
"category": "Cross Sectional",
"definition": "rank(x, rate=2)",
"description": "横截面排序",
"scope": ["REGULAR"],
},
{
"name": "ts_mean",
"category": "Time Series",
"definition": "ts_mean(x, d)",
"description": "时间序列均值",
"scope": ["REGULAR"],
},
],
)
if request.method == "OPTIONS" and request.url.path == "/simulations":
data = platform_response()
data["actions"]["POST"]["settings"]["children"]["neutralization"] = {
"choices": [{"value": "INDUSTRY"}, {"value": "NONE"}]
}
return httpx.Response(200, json=data)
if request.url.path.startswith("/data-fields/"):
return httpx.Response(
200,
json={
"availability": [
{"instrumentType": "EQUITY", "region": "USA", "universe": "TOP3000", "delay": 1}
]
},
)
return None