Move security/tick data classes to spark_core
* spark_core is the appropriate project for such 'vocabulary' types. * unit tests in the spark_tests project can now reference these types (this was the immediate impetus for the move).
This commit is contained in:
1 parent
db20473949
commit
ed920c7c5a
12 files changed
+27
-51
No files matched your search
@@ -1,28 +0,0 @@
|
||||
using bts.api;
|
||||
using System.ComponentModel.Composition;
|
||||
|
||||
namespace mbts.user.settings
|
||||
{
|
||||
[InheritedExport]
|
||||
internal interface ISecurityBasedSettingsFactory
|
||||
{
|
||||
SecurityBasedSettings get(Venue exchange, SecurityType type, string symbol);
|
||||
}
|
||||
|
||||
internal interface ISecurityBasedSettingsFactory<T> : ISecurityBasedSettingsFactory where T : class
|
||||
{
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoContract]
|
||||
[ProtoBuf.ProtoInclude(100, typeof(SecurityTickSettings))]
|
||||
internal abstract class SecurityBasedSettings
|
||||
{
|
||||
protected SecurityBasedSettings() { }
|
||||
protected SecurityBasedSettings(SecurityTuple security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoMember(1)]
|
||||
public SecurityTuple security;
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ using System.Threading.Tasks;
|
||||
using security_key = System.UInt32;
|
||||
|
||||
namespace mbts.co2 {
|
||||
unsafe class MDConsumerHandle {
|
||||
public unsafe class MDConsumerHandle {
|
||||
|
||||
// Once is_initialized goes true it never goes false
|
||||
public bool is_heart_beating { get { return Co2NativeMethods.md_consumer_is_heart_beating(_header); } }
|
||||
|
||||
@@ -3,7 +3,7 @@ using mbts.co2;
|
||||
using System;
|
||||
|
||||
namespace mbts {
|
||||
readonly struct SecurityMD : IEquatable<SecurityMD> {
|
||||
public readonly struct SecurityMD : IEquatable<SecurityMD> {
|
||||
public static readonly Func<SecurityMD, uint> key_fn = smd => smd.security.Id;
|
||||
|
||||
public SecurityImmutable security { get; }
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
using bts.api;
|
||||
|
||||
namespace mbts.user.settings
|
||||
{
|
||||
[ProtoBuf.ProtoContract]
|
||||
[ProtoBuf.ProtoInclude(100, typeof(SecurityTickSettings))]
|
||||
public abstract class SecurityBasedSettings {
|
||||
protected SecurityBasedSettings() { }
|
||||
protected SecurityBasedSettings(SecurityTuple security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
[ProtoBuf.ProtoMember(1)]
|
||||
public SecurityTuple security;
|
||||
}
|
||||
}
|
||||
+2
-2
@@ -11,7 +11,7 @@ namespace mbts
|
||||
/// Wraps up a security type, security name and exchange
|
||||
[ProtoContract]
|
||||
[Serializable]
|
||||
class SecurityTuple : IComparable<SecurityTuple>, IEquatable<SecurityTuple>
|
||||
public class SecurityTuple : IComparable<SecurityTuple>, IEquatable<SecurityTuple>
|
||||
{
|
||||
[ProtoMember(1)]
|
||||
public readonly SecurityType security_type;
|
||||
@@ -30,7 +30,7 @@ namespace mbts
|
||||
security_name = the_security_name;
|
||||
security_exchange = the_security_exchange;
|
||||
}
|
||||
public SecurityTuple(co2.UserSymbol u) : this(u.type, u.symbol, u.exchange) { }
|
||||
internal SecurityTuple(co2.UserSymbol u) : this(u.type, u.symbol, u.exchange) { }
|
||||
|
||||
public bool is_empty() { return Equals(empty); }
|
||||
|
||||
+1
-6
@@ -1,13 +1,11 @@
|
||||
using bts.utils;
|
||||
using mbts.spark.utilities;
|
||||
using mbts.ui;
|
||||
using ProtoBuf;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace mbts.user.settings {
|
||||
[ProtoContract]
|
||||
class RegionalTickFactors : IEquatable<RegionalTickFactors> {
|
||||
public class RegionalTickFactors : IEquatable<RegionalTickFactors> {
|
||||
[ProtoMember(1)]
|
||||
readonly TickFactors _low_tick;
|
||||
[ProtoMember(2)]
|
||||
@@ -24,11 +22,8 @@ namespace mbts.user.settings {
|
||||
_low_tick_inclusive_end = low_tick_inclusive_end;
|
||||
}
|
||||
|
||||
[DisplayInfo("Low")]
|
||||
public TickFactors low_tick => _low_tick;
|
||||
[DisplayInfo("High")]
|
||||
public TickFactors high_tick => _high_tick;
|
||||
[DisplayInfo("Inclusive Low Range End Pt")]
|
||||
public double low_tick_inclusive_end => _low_tick_inclusive_end;
|
||||
|
||||
public bool Equals(RegionalTickFactors other) =>
|
||||
+2
-6
@@ -1,21 +1,17 @@
|
||||
using mbts.ui;
|
||||
using ProtoBuf;
|
||||
using ProtoBuf;
|
||||
|
||||
namespace mbts.user.settings
|
||||
{
|
||||
[DisplayInfo("Tick Settings")]
|
||||
[ProtoContract]
|
||||
class SecurityTickSettings : SecurityBasedSettings
|
||||
public class SecurityTickSettings : SecurityBasedSettings
|
||||
{
|
||||
public SecurityTickSettings() {
|
||||
price_tick = new RegionalTickFactors();
|
||||
theo_tick = new TickFactors();
|
||||
}
|
||||
|
||||
[DisplayInfo("Price", style = DisplayInfo.DisplayStyle.GroupBox)]
|
||||
[ProtoMember(1)]
|
||||
public RegionalTickFactors price_tick { get; set; }
|
||||
[DisplayInfo("Theo")]
|
||||
[ProtoMember(2)]
|
||||
public TickFactors theo_tick { get; set; }
|
||||
}
|
||||
+2
-5
@@ -1,11 +1,10 @@
|
||||
using mbts.ui;
|
||||
using ProtoBuf;
|
||||
using ProtoBuf;
|
||||
using System;
|
||||
using System.ComponentModel;
|
||||
|
||||
namespace mbts.user.settings {
|
||||
[ProtoContract]
|
||||
class TickFactors : IEquatable<TickFactors> {
|
||||
public class TickFactors : IEquatable<TickFactors> {
|
||||
[ProtoMember(1), DefaultValue(100.0)]
|
||||
readonly double _tick_base;
|
||||
[ProtoMember(2), DefaultValue(1.0)]
|
||||
@@ -19,9 +18,7 @@ namespace mbts.user.settings {
|
||||
_tick_unit = tick_unit;
|
||||
}
|
||||
|
||||
[DisplayInfo("Base")]
|
||||
public double tick_base => _tick_base;
|
||||
[DisplayInfo("Unit")]
|
||||
public double tick_unit => _tick_unit;
|
||||
|
||||
public bool Equals(TickFactors other) =>
|
||||
File renamed without changes.
File renamed without changes.
+1
-1
@@ -7,7 +7,7 @@ using bts.api;
|
||||
using bts.utils;
|
||||
|
||||
namespace mbts {
|
||||
static class TickExtensions {
|
||||
public static class TickExtensions {
|
||||
const string _nan_text = "-";
|
||||
|
||||
#region Public Extensions (is_valid, format, parse, tick_up, tick_down)
|
||||
+1
-1
@@ -8,7 +8,7 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace mbts.spark {
|
||||
static class TickUtils {
|
||||
public static class TickUtils {
|
||||
internal static ContractSpecificationImmutable spec_or_default(this ContractSpecificationImmutable? spec) =>
|
||||
spec.HasValue ? spec.Value : SecurityDataHelper.Defaults.ContractSpecificationImmutable;
|
||||
|
||||
Reference in new issue
Block a user