Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanovnikolay committed Nov 2, 2010
1 parent 322c62c commit 0f55fd4
Show file tree
Hide file tree
Showing 18 changed files with 798 additions and 230 deletions.
135 changes: 122 additions & 13 deletions NXmlConnector/trunk/NXmlConnector.Model/AllTrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,68 +5,177 @@ namespace NXmlConnector.Model
{
public class AllTrade
{
[XmlAttribute("secid")]
public int SecurityId
{
get;
set;
}

[XmlElement("tradeno")]
public int TradeNo
{
get;
set;
}

[XmlElement("time")]
public string time;

public DateTime Time
public TimeSpan Time
{
get { return NXmlConverter.ToDateTime(time); }
get;
set;
}

[XmlElement("board")]
public string Board
{
get;
set;
}

[XmlElement("price")]
public double Price
{
get;
set;
}

[XmlElement("quantity")]
public int Quantity
{
get;
set;
}

[XmlElement("buysell")]
public OrderType BuySell
{
get;
set;
}

[XmlElement("period")]
public TradingStatus Period
{
get;
set;
}

[XmlElement("openinterest")]
public string OpenInterest
{
get;
set;
}

[XmlIgnore]
public AllTradeChanges LastChanges
{
get;
private set;
}


internal void Update(_AllTrade t)
{
LastChanges = new AllTradeChanges();

LastChanges.BoardChanged = !string.IsNullOrEmpty(t.Board);
if (!string.IsNullOrEmpty(t.Board)) Board = t.Board;

LastChanges.BuySellChanged = t.BuySell.HasValue;
if (t.BuySell.HasValue) BuySell = t.BuySell.Value;

LastChanges.OpenInterestChanged = !string.IsNullOrEmpty(t.OpenInterest);
if (!string.IsNullOrEmpty(t.OpenInterest)) OpenInterest = t.OpenInterest;

LastChanges.PeriodChanged = t.Period.HasValue;
if (t.Period.HasValue) Period = t.Period.Value;

LastChanges.PriceChanged = t.Price.HasValue;
if (t.Price.HasValue) Price = t.Price.Value;

LastChanges.QuantityChanged = t.Quantity.HasValue;
if (t.Quantity.HasValue) Quantity = t.Quantity.Value;

LastChanges.TimeChanged = !string.IsNullOrEmpty(t.Time);
if (!string.IsNullOrEmpty(t.Time)) Time = TimeSpan.Parse(t.Time);

LastChanges.TradeNoChanged = t.TradeNo.HasValue;
if (t.TradeNo.HasValue) TradeNo = t.TradeNo.Value;
}
}


public class AllTradeChanges
{
public bool TradeNoChanged
{
get;
set;
}

public bool TimeChanged
{
get;
set;
}

public bool BoardChanged
{
get;
set;
}

public bool PriceChanged
{
get;
set;
}

public bool QuantityChanged
{
get;
set;
}

public bool BuySellChanged
{
get;
set;
}

public bool PeriodChanged
{
get;
set;
}

public bool OpenInterestChanged
{
get;
set;
}
}

public class _AllTrade
{
[XmlAttribute("secid")]
public int SecurityId;

[XmlElement("tradeno")]
public int? TradeNo;

[XmlElement("time")]
public string Time;

[XmlElement("board")]
public string Board;

[XmlElement("price")]
public double? Price;

[XmlElement("quantity")]
public int? Quantity;

[XmlElement("buysell")]
public OrderType? BuySell;

[XmlElement("period")]
public TradingStatus? Period;

[XmlElement("openinterest")]
public string OpenInterest;
}
}
2 changes: 1 addition & 1 deletion NXmlConnector/trunk/NXmlConnector.Model/AllTrades.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace NXmlConnector.Model
public class AllTrades
{
[XmlElement("trade")]
public AllTrade[] TradesArray
public _AllTrade[] TradesArray
{
get;
set;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ protected override void WriteElement(XElement command)
{
command.Add(new XElement("proxy",
new XAttribute("type", Proxy.ProxyType == ProxyType.HttpConnect ? "HTTP-CONNECT" : Proxy.ProxyType.ToString().ToUpper()),
new XAttribute("addr", Proxy.Address),
new XAttribute("addr", Proxy.Host),
new XAttribute("port", Proxy.Port),
new XAttribute("login", Proxy.Login),
new XAttribute("password", Proxy.Password)));
Expand Down
5 changes: 5 additions & 0 deletions NXmlConnector/trunk/NXmlConnector.Model/MarketOrd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,10 @@ public int SecurityId

[XmlAttribute("permit")]
public YesNo permit;

public bool Permit
{
get { return permit == YesNo.yes; }
}
}
}
6 changes: 3 additions & 3 deletions NXmlConnector/trunk/NXmlConnector.Model/Proxy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public ProxyType ProxyType
set;
}

public string Address
public string Host
{
get;
set;
Expand Down Expand Up @@ -39,10 +39,10 @@ public Proxy()
{
}

public Proxy(ProxyType proxyType, string addrss, int port, string login, string passwoed)
public Proxy(ProxyType proxyType, string host, int port, string login, string passwoed)
{
ProxyType = proxyType;
Address = addrss;
Host = host;
Port = port;
Login = login;
Password = passwoed;
Expand Down
Loading

0 comments on commit 0f55fd4

Please sign in to comment.