Skip to content

Commit 6ad096a

Browse files
committed
Feat(topstep): Migrate to Native Cython Extension
- Add (Cython wrapper for REST + SignalR). - Replace Node.js bridge dependency with . - Update documentation.
1 parent 0989ead commit 6ad096a

6 files changed

Lines changed: 17583 additions & 2 deletions

File tree

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
from setuptools import setup, Extension
2+
from Cython.Build import cythonize
3+
4+
extensions = [
5+
Extension(
6+
"topstep_ext",
7+
["topstep.pyx"],
8+
language="c++",
9+
extra_compile_args=["-std=c++17", "-O3"]
10+
)
11+
]
12+
13+
setup(
14+
name="topstep_ext",
15+
ext_modules=cythonize(extensions, compiler_directives={'language_level': "3"}),
16+
)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import asyncio
2+
import logging
3+
from topstep_ext import TopstepClient
4+
5+
# Configure logging
6+
logging.basicConfig(level=logging.INFO)
7+
8+
async def main():
9+
print("--- Testing Topstep Extension ---")
10+
11+
# 1. Instantiate
12+
client = TopstepClient("https://api.topstepx.com")
13+
print(f"Client created. Base URL: {client.base_url}")
14+
15+
# 2. Check attributes
16+
print(f"Token (should be empty): '{client.token}'")
17+
18+
# 3. Test SignalR (Mock)
19+
# We expect ValueError because of no token
20+
try:
21+
client.connect_signalr()
22+
except ValueError as e:
23+
print(f"Caught expected error: {e}")
24+
25+
print("SUCCESS: TopstepClient instantiated and verified.")
26+
27+
if __name__ == "__main__":
28+
try:
29+
asyncio.run(main())
30+
except KeyboardInterrupt:
31+
pass

0 commit comments

Comments
 (0)