-
Notifications
You must be signed in to change notification settings - Fork 4
FIX: reprice LMT orders n times, then replace with MKT; add new weight verification endpoint #108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0f78b9b
1687a5e
6a06cc5
2689868
6271abd
9adff79
518d09d
0ff5819
028681f
3fd054d
60bffdd
ea70003
470723a
e329e1a
f3ea977
0f1e57a
cd8338f
c520a91
a9c0c2e
6971185
81df924
c79efff
8098625
0a76688
770af46
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| namespace YoloAbstractions; | ||
|
|
||
| public sealed record BrokerAccountContext(string? Address, string? VaultAddress); |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| namespace YoloAbstractions; | ||
|
|
||
| public record BrokerOrderEvent( | ||
| string ClientOrderId, | ||
| Order Order, | ||
| bool Success, | ||
| string? Error = null, | ||
| int? ErrorCode = null); |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,7 +11,15 @@ public static class YoloConfigExtensions | |||||
| return configuration | ||||||
| .GetSection(Yolo) | ||||||
| .Get<YoloConfig>() | ||||||
| ?.Ensure(c => c.AssetPermissions > AssetPermissions.None) | ||||||
| ?.Ensure(c => c.BaseAsset) | ||||||
| ?.Ensure(c => c.TradeBuffer); | ||||||
| ?.Ensure(c => c.MaxLeverage > 0) | ||||||
| ?.Ensure(c => c.MaxRepriceRetries >= 0) | ||||||
| ?.Ensure(c => c.MaxWeightingAbs > 0) | ||||||
| ?.Ensure(c => c.MinOrderValue == null || c.MinOrderValue > 0) | ||||||
| ?.Ensure(c => c.NominalCash > 0) | ||||||
| ?.Ensure(c => c.SpreadSplit >= 0 && c.SpreadSplit <= 1) | ||||||
| ?.Ensure(c => c.TradeBuffer >= 0) | ||||||
| ?.Ensure(c => TimeSpan.Parse(c.UnfilledOrderTimeout) > TimeSpan.Zero); | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: When TimeSpan.Parse receives an invalid string in .NET, it throws a FormatException if the string has an invalid format, an OverflowException if the value is outside TimeSpan.MinValue/MaxValue or components are out of range, or ArgumentNullException if the input is null. In contrast, TimeSpan.TryParse does not throw exceptions on invalid input; it returns false and sets the out TimeSpan parameter to TimeSpan.Zero, indicating parsing failure without exceptions. Citations:
🏁 Script executed: cd src/YoloAbstractions/Extensions && cat -n YoloConfigExtensions.cs | head -40Repository: moconnell/yolo Length of output: 1206 Use
Suggested fix- ?.Ensure(c => TimeSpan.Parse(c.UnfilledOrderTimeout) > TimeSpan.Zero);
+ ?.Ensure(c => TimeSpan.TryParse(c.UnfilledOrderTimeout, out var timeout) && timeout > TimeSpan.Zero);📝 Committable suggestion
Suggested change
🤖 Prompt for AI Agents |
||||||
| } | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| namespace YoloAbstractions.Interfaces; | ||
|
|
||
| public interface ITradeAdvisor | ||
| { | ||
| /// <summary> | ||
| /// Called when a limit order times out. Returns the replacement trade to place (with fresh | ||
| /// prices and positions), or null if the position is already within target (nothing to do). | ||
| /// </summary> | ||
| Task<Trade?> GetReplacementTradeAsync(Trade timedOutTrade, CancellationToken ct = default); | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,3 @@ | ||
| namespace YoloAbstractions; | ||
|
|
||
| public record OrderManagementSettings( | ||
| TimeSpan UnfilledOrderTimeout = default, | ||
| bool SwitchToMarketOnTimeout = true, | ||
| TimeSpan StatusCheckInterval = default) | ||
| { | ||
| public static OrderManagementSettings Default => new( | ||
| UnfilledOrderTimeout: TimeSpan.FromMinutes(5), | ||
| SwitchToMarketOnTimeout: true, | ||
| StatusCheckInterval: TimeSpan.FromSeconds(30)); | ||
| } | ||
| public record OrderManagementSettings(TimeSpan UnfilledOrderTimeout, int MaxRepriceRetries); | ||
moconnell marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Uh oh!
There was an error while loading. Please reload this page.