本文整理汇总了C#中Market类的典型用法代码示例。如果您正苦于以下问题:C# Market类的具体用法?C# Market怎么用?C# Market使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Market类属于命名空间,在下文中一共展示了Market类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ShouldExecuteInstructionWhenThereIsEnoughLiquidityOnOneMarket
public void ShouldExecuteInstructionWhenThereIsEnoughLiquidityOnOneMarket()
{
// Given market A: 150 @ $100, market B: 55 @ $101
// When Investor wants to buy 125 stocks @ $100 Then SOR can execute at the requested price
var marketA = new Market
{
SellQuantity = 150,
SellPrice = 100M
};
var marketB = new Market
{
SellQuantity = 55,
SellPrice = 101M
};
var marketsInvolved = new[] { marketA, marketB };
ICanRouteOrders canRouteOrders = null;//new OrderRoutingService(marketsInvolved);
ICanReceiveMarketData canReceiveMarketData = new MarketDataProvider(marketsInvolved);
IProvideMarkets provideMarkets = new MarketProvider(marketsInvolved);
var sor = new SmartOrderRoutingEngine(provideMarkets, canRouteOrders, canReceiveMarketData);
var investorInstructionDto = new InvestorInstructionDto(new InvestorInstructionIdentifierDto(), Way.Buy, quantity: 125, price: 100M);
OrderExecutedEventArgs orderExecutedEventArgs = null;
sor.Subscribe(investorInstructionDto.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, null);
//investorInstruction.Executed += (sender, args) => { orderExecutedEventArgs = args; };
// orderRequest.Route(); ?
sor.Route(investorInstructionDto);
// TODO :introduce autoreset event instead
Check.That(orderExecutedEventArgs).HasFieldsWithSameValues(new { Way = Way.Buy, Quantity = 125, Price = 100M });
}
示例2: Save
public static int Save(Market m)
{
var ctx = new AutoNewsEntities();
if (m.Id == 0)
{
if (ctx.Markets.Count(o => (o.Name == m.Name && o.MarketTypeId == m.MarketTypeId) || o.MarketCrmId == m.MarketCrmId) > 0)
{
throw new Exception("名称或CRM ID已存在!");
}
ctx.Markets.Add(m);
return 1;
}
//id != 0
if (ctx.Markets.Count(o => ((o.Name == m.Name && o.MarketTypeId == m.MarketTypeId) || o.MarketCrmId == m.MarketCrmId) && o.Id != m.Id) > 0)
{
throw new Exception("名称或CRM ID已存在!");
}
var market = ctx.Markets.Single(o => o.Id == m.Id);
market.Auto = m.Auto;
market.EndTime = m.EndTime;
market.MarketCrmId = m.MarketCrmId;
market.Name = m.Name;
market.StartTime = m.StartTime;
ctx.SaveChanges();
return 2;
}
示例3: MockTradeFinderFactory
public MockTradeFinderFactory(Map map, Market market, string logFilePath, Parameters parameters) : base("")
{
this.map = map;
this.market = market;
this.logFilePath = logFilePath;
this.parameters = parameters;
}
示例4: resetReferencesForNewLevel
public static void resetReferencesForNewLevel()
{
// Managers
manager = GameObject.FindGameObjectWithTag("Manager");
stateManager = manager.GetComponent<StateManager>();
stateTiming = manager.GetComponent<StateTiming>();
// Game stats and information
gameStats = manager.GetComponent<GameStats>();
itemDatabase = manager.GetComponent<Item_Database>();
inventory = manager.GetComponent<Inventory>();
market = manager.GetComponent<Market>();
marketArrays = manager.GetComponent<MarketArrays>();
soundEffects = GameObject.FindObjectOfType<SoundEffectsDatabase>().GetComponent<SoundEffectsDatabase>();
// Cameras
realtimeCamera = GameObject.FindGameObjectWithTag("Camera_Realtime").GetComponent<Camera>();
strategicCamera = GameObject.FindGameObjectWithTag("Camera_Strategic").GetComponent<Camera>();
// Game entities
player = GameObject.FindGameObjectWithTag("Player");
castle = GameObject.FindGameObjectWithTag("Castle");
soundEffect = (GameObject)Resources.Load("OneTimeSoundEffect", typeof(GameObject));
// Data
lastLevelIndex = Application.loadedLevel;
currentLevel = 1;
}
示例5: Export
public override IDictionary<long, Dictionary<string, string>> Export(IList<Trade> inTrades, Filter inFilter, Stream stream, Market market, IList<Exception> exceps)
{
var task = _task;
var filter = task.Filter;
var date = market.Date(_effectiveTime);
var trades = Env.Current.Trade.GetTrades2(filter, date, _effectiveTime);
using (var writer = new StreamWriter(stream))
{
WriteHeader(writer);
foreach (var trade in trades)
{
if (trade.Product == null)
{
exceps.Add(new ApplicationException(String.Format("Trade {0} is invalid. Missing product.", trade.Id)));
continue;
}
if(trade.TradeTime > _effectiveTime)
{
continue;
}
string line = WriteTrade(trade, date, _effectiveTime, exceps);
if (!Utilities.IsNullOrEmpty(line))
{
writer.WriteLine(line);
}
}
}
return null;
}
示例6: ShouldFaileWhenOrderExceedsAllMarketCapacityAndPartialExecutionNotAllowed
public void ShouldFaileWhenOrderExceedsAllMarketCapacityAndPartialExecutionNotAllowed()
{
// Given market A: 150 @ $100, market B: 55 @ $101
// When Investor wants to buy 125 stocks @ $100 Then SOR can execute at the requested price
var marketA = new Market
{
SellQuantity = 15,
SellPrice = 100M
};
var marketB = new Market
{
SellQuantity = 55,
SellPrice = 101M
};
var sor = CreateSmartOrderRoutingEngine(new[] { marketA, marketB });
var investorInstruction = new InvestorInstructionDto(new InvestorInstructionIdentifierDto(), Way.Buy, quantity: 125, price: 100M, allowPartialExecution: false);
// Subscribes to the instruction's events
OrderExecutedEventArgs orderExecutedEventArgs = null;
string failureReason = null;
sor.Subscribe(investorInstruction.UniqueIdentifier, (args) => { orderExecutedEventArgs = args; }, (args) => { failureReason = args; });
// orderRequest.Route(); ?
sor.Route(investorInstruction);
// Couldn't execute because order with excessive quantity
Check.That(failureReason).IsNotNull().And.IsEqualIgnoringCase("Excessive quantity!");
Check.That(orderExecutedEventArgs).IsNull();
}
示例7: Start
// Use this for initialization
void Start()
{
animator = GetComponent<Animator>();
//mainGame = GameLogicGameObject.GetComponent<WeedGame>();
market = GameLogicGameObject.GetComponent<Market>();
}
示例8: HandleLines
static bool HandleLines(IList<string> lines, Market market, char[] seps, StringBuilder sb)
{
//Read First Line to fin Vol Surface and if its Rho or Nu
bool isRho = true;
InterestVolatility vol = null;
var firstLine = lines.FirstOrDefault();
if (string.IsNullOrEmpty(firstLine))
{
sb.Append("Cannot parse first line");
return false;
}
var ss = firstLine.Split(seps);
var sdate = ss[2];
var stype = ss[3];
var ticker = ss[4];
var date = SimpleDate.Parse(sdate);
isRho = stype.ToUpper().Contains("RHO");
var isBeta = stype.ToUpper().Contains("BETA");
ss = ticker.Split('.');
var name = ss[0];
var ccy = ss[1];
var time = date.ToDateTime(23, 59, 59);
market.Time = time;
market.ClearMarketDatas();
var vols = market.GetAll(true, false, false, true, false, false, false, false, false, false, false, false, false);
foreach (var im in vols)
{
var ivol = im as InterestVolatility;
if (ivol != null && ivol.Currency.Equals(ccy))
{
vol = ivol;
break;
}
}
if (vol == null)
{
sb.Append("Cannot Find Any Vol for " + ticker);
return false;
}
var output = vol.Output as InterestVolatilityOutput;
if (output == null)
{
sb.Append("Invalid Vol not built " + vol);
return false;
}
var data = new List<SabrData>();
foreach (var line in lines)
{
var d = new SabrData();
ss = line.Split(seps);
var tick = ss[4];
d.Date = SimpleDate.Parse(ss[2]).ToDateTime();
d.ComponentTicker = tick;
d.InstrumentType = ss[3];
d.Value = Convert.ToDouble(ss[5]);
data.Add(d);
}
return HandleData(vol, isRho, isBeta, data, market, sb);
}
示例9: AddTopMarket
public Market AddTopMarket(int marketId)
{
var market = new Market() {
Id = marketId
};
return _marketDataStore.TopMarketSave(market);
}
示例10: Value
public object Value(string columnName, Market market, PLItem item, PLReport report)
{
if (mColumns.ContainsKey(columnName))
{
return mColumns[columnName].Value(market, item, report);
}
return null;
}
示例11: Value
public object Value(Market market, PLEntry entry, PlBlotter blotter)
{
if (entry != null)
{
return entry.EndNominal - entry.StartNominal;
}
return null;
}
示例12: TestFixtureSetUp
public void TestFixtureSetUp()
{
itemDatabase = TestObjectFactory.CreateItemDatabase();
map = TestObjectFactory.CreateMap();
market = TestObjectFactory.CreateMarket(itemDatabase, map);
kernite = itemDatabase.GetItemType("Kernite");
navitas = itemDatabase.GetItemType("Navitas");
}
示例13: Value
public object Value(Market market, PLEntry entry, PlBlotter blotter)
{
if(entry != null && entry.Trade != null && entry.Trade.InitialPartyId != 0)
{
var party = Env.Current.StaticData.GetPartyById(entry.Trade.InitialPartyId);
return party.Code;
}
return null;
}
示例14: MarketOrderShouldDecreaseAvailableQuantity
public void MarketOrderShouldDecreaseAvailableQuantity()
{
var market = new Market { SellPrice = 100M, SellQuantity = 50 };
var order = market.CreateMarketOrder(Way.Buy, quantity: 10);
market.Send(order);
Check.That(market.SellQuantity).IsEqualTo(40);
}
示例15: TestFixtureSetUp
public void TestFixtureSetUp()
{
testLogPath = TestObjectFactory.TestDirectory + "Logs";
testNoLogPath = TestObjectFactory.TestDirectory + "NoLogs";
archiveBasePath = TestObjectFactory.TestDirectory + "Logs" + "\\Temp";
map = TestObjectFactory.CreateMap();
database = TestObjectFactory.CreateItemDatabase();
market = TestObjectFactory.CreateMarket(database, map);
parameters = new Parameters(1000.0f, 100.0f, "Sol", TripType.SingleTrip);
}