QuantConnect / LEANQuantConnect / LEAN
A cloud platform for researching, backtesting and live trading algorithms, built on the open-source LEAN engine.פלטפורמת ענן למחקר, backtesting ומסחר חי באלגוריתמים, שבנויה על מנוע LEAN בקוד פתוח.
What is it?מה זה?
QuantConnect is a browser-based platform where you write algorithms in Python or C#, backtest them on hosted historical data across multiple asset classes, and deploy them to paper or live trading through supported brokers. Under the hood it runs LEAN, an open-source, event-driven algorithmic trading engine that you can also run on your own machine with the LEAN CLI. It also offers research notebooks and an active community forum.QuantConnect היא פלטפורמה מבוססת דפדפן שבה כותבים אלגוריתמים ב-Python או ב-C#, מריצים להם backtest על נתונים היסטוריים מתארחים בכמה סוגי נכסים, ומעלים אותם למסחר מדומה (paper) או חי דרך ברוקרים נתמכים. מתחת למכסה רץ LEAN, מנוע מסחר אלגוריתמי event-driven בקוד פתוח, שאפשר להריץ גם על המחשב שלכם עם ה-LEAN CLI. יש בה גם research notebooks וקהילה פעילה בפורום.
Why it matters for quantsלמה זה חשוב לקוואנטים
An event-driven backtester processes data one bar or tick at a time, the same way a live system does, which makes it much harder to accidentally use future data. QuantConnect bundles data, engine, research and live deployment, so you can go from idea to paper trading without building infrastructure. LEAN models realistic details such as fees, slippage, corporate actions and order types. Because the engine is open source, professionals can inspect exactly how fills and costs are modeled.Backtester מסוג event-driven מעבד את הנתונים בר אחר בר או tick אחר tick, בדיוק כמו מערכת חיה, וזה מקשה מאוד להשתמש בטעות במידע מהעתיד. QuantConnect מאגדת נתונים, מנוע, מחקר והפעלה חיה, כך שאפשר לעבור מרעיון ל-paper trading בלי לבנות תשתית. LEAN ממדל פרטים ריאליסטיים כמו עמלות, slippage, אירועי חברה וסוגי פקודות. מכיוון שהמנוע בקוד פתוח, אנשי מקצוע יכולים לבדוק בדיוק איך ממודלים ביצועים ועלויות.
What quants look forמה קוואנטים מחפשים שם
- The algorithm lifecycle: initialize() to set dates, cash and data subscriptions, and on_data() to react to new dataמחזור החיים של אלגוריתם: initialize() להגדרת תאריכים, הון ומינויי נתונים, ו-on_data() לתגובה לנתונים חדשים
- Hosted historical data for equities, options, futures, forex and cryptoנתונים היסטוריים מתארחים למניות, אופציות, חוזים עתידיים, מט"ח וקריפטו
- Universe selection to pick stocks dynamically, which reduces survivorship biasUniverse selection לבחירת מניות באופן דינמי, מה שמקטין survivorship bias
- Fee, slippage and fill models, and backtest statistics such as Sharpe ratio and drawdownמודלים של עמלות, slippage וביצוע, וסטטיסטיקות backtest כמו Sharpe ratio ו-drawdown
- The LEAN CLI for running backtests locallyה-LEAN CLI להרצת backtests מקומית
How to get startedאיך מתחילים
- Create a free account on quantconnect.com and open the Algorithm Lab.פתחו חשבון חינמי ב-quantconnect.com והיכנסו ל-Algorithm Lab.
- Create a new Python project and replace the template with the example below.צרו פרויקט Python חדש והחליפו את התבנית בדוגמה למטה.
- Run a backtest and study the results page: equity curve, drawdown, trades and statistics.הריצו backtest ועברו על דף התוצאות: עקומת הון, drawdown, עסקאות וסטטיסטיקות.
- Follow the Bootcamp tutorials, and later try the LEAN CLI (pip install lean) to run locally.עברו על מדריכי ה-Bootcamp, ובהמשך נסו את ה-LEAN CLI (pip install lean) להרצה מקומית.
Code exampleדוגמת קוד
from AlgorithmImports import *
class BuyAndHoldSPY(QCAlgorithm):
def initialize(self):
self.set_start_date(2020, 1, 1)
self.set_cash(100000)
self._spy = self.add_equity("SPY", Resolution.DAILY).symbol
def on_data(self, data: Slice):
if not self.portfolio.invested:
self.set_holdings(self._spy, 1)
A minimal buy-and-hold algorithm using the current snake_case Python API. It runs inside QuantConnect or LEAN, not as a standalone script.אלגוריתם buy-and-hold מינימלי שמשתמש ב-API הנוכחי של Python בכתיב snake_case. הוא רץ בתוך QuantConnect או LEAN, לא כסקריפט עצמאי.
Tips & pitfallsטיפים ומלכודות
- A great backtest is only a hypothesis. Paper trade before risking real money, and compare live fills with backtest assumptions.Backtest מצוין הוא רק השערה. עשו paper trading לפני שאתם מסכנים כסף אמיתי, והשוו את הביצועים בפועל להנחות ה-backtest.
- Running many parameter combinations and picking the best one is overfitting. Keep an out-of-sample period untouched.הרצה של הרבה צירופי פרמטרים ובחירת הטוב ביותר היא overfitting. השאירו תקופה מחוץ למדגם שלא נוגעים בה.
- Older tutorials use the PascalCase API (Initialize, OnData). The current Python API uses snake_case, so adapt old examples.מדריכים ישנים משתמשים ב-API בכתיב PascalCase (Initialize, OnData). ה-API הנוכחי של Python משתמש ב-snake_case, אז התאימו דוגמאות ישנות.
Relatedקשור
Sourcesמקורות
Quant Israel is not affiliated with this service or company. Details may change — check the official site. Nothing here is investment advice.Quant Israel אינה קשורה לשירות או לחברה הזו. הפרטים עשויים להשתנות — בדקו באתר הרשמי. שום דבר כאן אינו ייעוץ השקעות.