本文整理汇总了C#中Order.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# Order.ToString方法的具体用法?C# Order.ToString怎么用?C# Order.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Order
的用法示例。
在下文中一共展示了Order.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tl_newSendOrderRequest
long tl_newSendOrderRequest(Order o)
{
if (isPaperTradeEnabled)
{
ptt.sendorder(o);
}
else
{
debug("paper trade disabled, ignoring order: "+o.ToString());
}
return 0;
}
示例2: Get
public async Task<ResponseWrapper<PullRequest>> Get(string projectKey, string repositorySlug, Order order, RequestOptions options = null, Direction direction = Direction.INCOMING,
PullRequestState state = PullRequestState.OPEN, bool withAttributes = true, bool withProperties = true)
{
string requestUrl = UrlBuilder.ToRestApiUrl(string.Format(PULL_REQUEST, projectKey, repositorySlug))
.WithOptions(options)
.WithQueryParam("direction", direction.ToString())
.WithQueryParam("state", state.ToString())
.WithQueryParam("withAttributes", withAttributes.ToString())
.WithQueryParam("withProperties", withProperties.ToString())
.WithQueryParam("order", order.ToString());
var pr = await _httpWorker.GetAsync<ResponseWrapper<PullRequest>>(requestUrl).ConfigureAwait(false);
return pr;
}
示例3: tl_newSendOrderRequest
void tl_newSendOrderRequest(Order o)
{
GTSession.GTOrder32 order = new GTSession.GTOrder32();
order.szStock = o.symbol;
//order.place = o.ex;
order.szAccountID = o.Account;
order.chSide = o.side ? 'B' : 'S';
order.dblPrice = (double)o.price;
order.dblStopLimitPrice = (double)o.stopp;
order.dwShare = o.UnsignedSize;
// this should be order id
order.dwUserData = o.id==0 ? OrderImpl.Unique : o.id;
// send order
GTStock stock = m_session.GetStock(o.symbol);
int err = stock.PlaceOrder(order);
if (err != 0)
{
debug("error " + err.ToString() + " sending: " + o.ToString());
}
}
示例4: Ticket
/// <summary>
/// creates ticket with default order
/// </summary>
/// <param name="working"></param>
public Ticket(Order working)
{
InitializeComponent();
work = working;
if (work.Security == SecurityType.FUT)
{
osize.Increment = 1;
osize.Value = 1;
}
isize = work.UnsignedSize;
Text = work.symbol;
osize.Text = work.ToString();
oprice.Text = work.price.ToString();
if (work.side) { obuybut.Checked = true; osellbut.Checked = false; }
else { osellbut.Checked = true; obuybut.Checked = false; }
oprice.MouseWheel += new MouseEventHandler(order_MouseWheel);
osize.MouseWheel += new MouseEventHandler(osize_MouseWheel);
}
示例5: tl_newSendOrderRequest
/// <summary>
/// Submit a new order and if successful and if the o.id != 0, map the incoming TradeLink o.ID to the order Token returned in res
/// </summary>
/// <param name="o"></param>
/// <returns></returns>
long tl_newSendOrderRequest(Order o)
{
test(o);
v("received new order: " + o.ToString());
string strType = "MBConst.VALUE_MARKET";
int side = o.side ? MBConst.VALUE_BUY : MBConst.VALUE_SELL;
int tif = MBConst.VALUE_GTC;
//TODO: need to modify type depending on the type of order
int otype = MBConst.VALUE_MARKET;
//debug(String.Format("new order isLimit:{0} isStop:{1} isMarket:{2}", o.isLimit, o.isStop, o.isMarket));
if (o.isMarket)
{
otype = MBConst.VALUE_MARKET;
strType = "MBConst.VALUE_MARKET";
}
else if (o.isLimit && o.isStop)
{
otype = MBConst.VALUE_STOP_LIMIT;
strType = "MBConst.VALUE_STOP_LIMIT";
}
else if (o.isLimit)
{
otype = MBConst.VALUE_LIMIT;
strType = "MBConst.VALUE_LIMIT";
}
else if (o.isStop)
{
otype = MBConst.VALUE_STOP_MARKET;
strType = "MBConst.VALUE_STOP_MARKET";
}
else if (o.isTrail)
{
otype = MBConst.VALUE_TRAILING_STOP;
strType = "MBConst.VALUE_TRAILING_STOP";
}
else
{
strType = "UNKNOWN";
}
debug(String.Format("TradeLink order is type: {0}:{1}", otype, strType));
if (o.comment != null && o.comment != "")
debug(String.Format("Order has comment:{0}", o.comment));
string route = "MBTX";
int voltype = MBConst.VALUE_NORMAL;
DateTime dt = new DateTime(0);
string pbstrRetMsg = null;
string token = null;
MbtAccount m_account = getaccount(o.Account);
bool bManuallyPlaced = false; // 9/13/12 - pmh
//bool good = m_OrderClient.Submit(side, o.UnsignedSize, o.symbol, (double)o.price, (double)o.stopp, tif, 0, otype, voltype, 0, m_account, route, "", 0, 0, dt, dt, 0, 0, 0, 0, 0, ref res);
bool bSubmit = m_OrderClient.Submit(
side, //lBuySell
o.UnsignedSize,
o.symbol,
(double)o.price,
(double)o.stopp,
tif,
MBConst.VALUE_AGENCY, //0, // 9/1/12 - pmh lCapacity cannot be zero
otype,
voltype,
0, //lDisplayQty
m_account,
route,
"", //Deprecated - bstrPrefMMID
0, //dPriceOther
0, //dPriceOther2
dt, //timeActivate - previously not used, not sure at the moment
dt, //timeExpire - previously not used and not yet in the new UI, still checking on this
0, //lExpMonth
0, //lExpYear
0, //dStrikePrice
"", //bstrCondSymbol - just added, not sure if it's implemented yet
0, //lCondType - just implemented
0, //dCondPrice - just added, not sure if it's implemented yet
0, // 9/13/12 - pmh - Group Type
"", // 9/13/12 - pmh - Group ID
bManuallyPlaced, // 9/13/12 - pmh
ref pbstrRetMsg);
if (!bSubmit)
{
//debug(String.Format("The following order failed: {0}\nreason:{1} {2}", o, o.Account, pbstrRetMsg));
debug(String.Format("Order failed: [{o}]. Account [{1}]. pbstrRetMsg: [{2}]", o, o.Account, pbstrRetMsg)); // 9/13/12 - pmh
}
else
{
token = pbstrRetMsg;
//debug(String.Format("Order sent to server and waiting success: {0}\ninfo: {1} {2}", o, o.Account, token));
debug(String.Format("Order sent: [{o}]. Account [{1}]. token: [{2}]", o, o.Account, token)); // 9/13/12 - pmh
// if the order ID is not 0, map it to the token
if (o.id != 0)
{
//get the broker Token and save the association
if (!tl2broker.ContainsKey(o.id))
{
//.........这里部分代码省略.........
示例6: tl_gotOrder
void tl_gotOrder(Order o)
{
debug("orderack: " + o.ToString());
if (orderidx(o.id)==-1) // if we don't have this order, add it
ordergrid.Rows.Add(new object[] { o.id, o.symbol, (o.side ? "BUY" : "SELL"), o.UnsignedSize, (o.price == 0 ? "Market" : o.price.ToString(_dispdecpointformat)), (o.stopp == 0 ? "" : o.stopp.ToString(_dispdecpointformat)), o.Account });
}
示例7: t_neworder
void t_neworder(Order sendOrder)
{
if (accountname.Text != "")
sendOrder.Account = accountname.Text;
if (exchdest.Text != "")
sendOrder.Exchange = exchdest.Text;
if (sendOrder.id == 0)
sendOrder.id = idt.AssignId;
int res = _bf.SendOrder(sendOrder);
if (res != 0)
{
string err = Util.PrettyError(_bf.BrokerName, res);
status(err);
debug(sendOrder.ToString() + "( " + err + " )");
}
else
debug("order: "+sendOrder.ToString());
}
示例8: t_neworder
void t_neworder(Order sendOrder)
{
if (accountname.Text != "")
sendOrder.Account = accountname.Text;
if (exchdest.Text != "")
sendOrder.Exchange = exchdest.Text;
int res = tl.SendOrder(sendOrder);
if (res != 0)
{
string err = Util.PrettyError(tl.BrokerName,res);
status(err);
debug(sendOrder.ToString() + "( " + err + " )");
}
}
示例9: workingres_SendOrder
void workingres_SendOrder(Order o, int id)
{
int rid = r2r(id);
if (rid < 0)
{
debug("Ignoring order from response with invalid id: " + id + " index not found. order: "+o.ToString());
return;
}
if (!_reslist[rid].isValid)
{
debug("Ignoring order from disabled response: " + _reslist[rid].Name + " order: " + o.ToString());
return;
}
// process order coming from a response
if (_bf.BrokerClient== null)
{
debug("Can't send orders, no execution broker available.");
status("No execution broker found.");
return;
}
// set account on order
if (o.Account==string.Empty)
o.Account = _ao._account.Text;
try
{
// set the security
if (o.Security== SecurityType.NIL)
o.Security = _seclist[o.symbol].Type;
// set the exchange
if (o.Exchange== string.Empty)
o.Exchange = _seclist[o.symbol].DestEx;
}
catch (KeyNotFoundException)
{
SecurityImpl sec = SecurityImpl.Parse(o.symbol);
o.Security = sec.Type;
if (o.ex==string.Empty)
o.Exchange = sec.DestEx;
}
// if still empty, use default
if (o.ex == string.Empty)
o.Exchange = _ao._dest.Text;
// set the local symbol
if ((o.LocalSymbol==string.Empty) && (o.Sec.Type!= SecurityType.CASH))
o.LocalSymbol = o.symbol;
// assign master order if necessary
assignmasterorderid(ref o);
// send order and get error message
int res = _bf.SendOrder(o);
// if error, display it
if (res != (int)MessageTypes.OK)
debug(Util.PrettyError(_bf.BrokerClient.BrokerName, res) + " " + o.ToString());
}
示例10: ServerBlackwood_newSendOrderRequest
long ServerBlackwood_newSendOrderRequest(Order o)
{
v(o.symbol + " received sendorder request for: " + o.ToString());
if ((o.id != 0) && !isunique(o))
{
v(o.symbol + " dropping duplicate order: " + o.ToString());
return (long)MessageTypes.DUPLICATE_ORDERID;
}
if (o.id == 0)
o.id = _id.AssignId;
int orderCID = (int)o.id;
string sSymbol = o.symbol;
ORDER_SIDE orderSide = (o.side ? ORDER_SIDE.SIDE_BUY : ORDER_SIDE.SIDE_SELL);
BWVenue orderVenue = getVenueFromBW(o);
BWOrderType orderType = (o.isStop ? (o.isLimit ? BWOrderType.STOP_LIMIT : BWOrderType.STOP_MARKET) : (o.isLimit ? BWOrderType.LIMIT : BWOrderType.MARKET));
int orderTIF = (int)getDurationFromBW(o);
uint orderSize = (uint)o.UnsignedSize;
int orderReserve = o.UnsignedSize;
float orderPrice = (float)o.price;
float orderStopPrice = (float)o.stopp;
// create a new BWOrder with these parameters
BWOrder bwOrder = new BWOrder(m_Session, sSymbol, orderSide, orderSize, orderPrice, orderType, orderTIF, orderVenue, false, orderSize);
bwOrder.CustomID = orderCID;
bwOrder.SmartID = orderCID;
// subscribe to this order's events
bwOrder.BWOrderUpdateEvent += new BWOrder.BWOrderUpdateHandler(bwOrder_BWOrderUpdateEvent);
// add a BWStock object for this symbol to the list of stocks that have had orders placed
// so that it can be referred to for position management
try
{
// GetStock throws an exception if not connected to Market Data
BWStock stock = m_Session.GetStock(bwOrder.Symbol);
}
catch (ClientPortalConnectionException e)
{
debug(e.Message);
}
// send the order
bwOrder.Send();
_bwOrdIds.Add(o.id, 0);
v(o.symbol + " sent order: " + o.ToString());
return (long)MessageTypes.OK;
}
示例11: sot_OrderIdStatusEvent
void sot_OrderIdStatusEvent(Order o, int stat, Providers p, int conid)
{
debug(o.symbol + " " + p.ToString() + " [con: " + conid + " order status: " + stat + " order: " + o.ToString());
}
示例12: getside
string getside(Order o)
{
bool side = o.side;
string symbol = o.symbol;
// use by and sell as default
string r = side ? "B" : "S";
if (CoverEnabled)
{
// if we're flat or short and selling, mark as a short
if ((pt[symbol,o.Account].isFlat || pt[symbol, o.Account].isShort) && !side)
{
v(o.symbol + " marking order as short: " + o.ToString()+ " pos: "+pt[symbol,o.Account]);
r = "T";
}
// if short and buying, mark as cover
else if (pt[symbol,o.Account].isShort && side)
{
v(o.symbol + " marking order as cover: " + o.ToString() + " pos: " + pt[symbol, o.Account]);
r = "C";
}
}
if (RegSHOShorts)
{
// see if order needs short marking (versus sell)
if (sho.isOrderShort(o))
{
v(o.symbol + " marking order as regsho short: " + o);
r = "T";
}
else
v(o.symbol + " not a regsho short order: " + o);
}
return r;
}
示例13: sendorder
public void sendorder(Order o)
{
// get original size
int osize = o.size;
int uosize = o.UnsignedSize;
// get existing size
int size = _pt[o.symbol].Size;
// check for overfill/overbuy
bool over = o.size * size < -1;
// detect
if (over)
{
// determine correct size
int oksize = _pt[o.symbol].FlatSize;
// adjust
o.size = oksize;
// send
sonow(o);
// count
osa++;
// notify
debug(o.symbol + " oversell detected: " + osize + ">" + size + " adjusted to: " + o.ToString());
// see if we're splitting
if (Split)
{
// calculate new size
int nsize = Math.Abs(uosize - Math.Abs(oksize));
// adjust side
nsize *= (o.side ? 1 : -1);
// create order
Order newo = new OrderImpl(o);
newo.size = nsize;
// send
sonow(newo);
// notify
debug(o.symbol + " splitting oversell/overcover to 2nd order: " + newo);
}
}
else
sonow(o);
}
示例14: sendordernow
int sendordernow(Order o)
{
if (_tl == null) return (int)MessageTypes.BROKERSERVER_NOT_FOUND;
int err = _tl.SendOrder(o);
if (err != 0)
{
debug(o.symbol + " order err: " + err + " " + Util.PrettyError(_tl.BrokerName, err));
}
else
{
_loaded[o.symbol] = true;
debug(o.symbol + " order sent: " + o.ToString());
}
if ((o.id != 0) && (OrderIdStatusEvent != null))
OrderIdStatusEvent(o, err, _tl.BrokerName, _tl.ProviderSelected);
return err;
}
示例15: workingres_SendOrder
void workingres_SendOrder(Order o, int id)
{
int rid = r2r(id);
if (rid < 0)
{
debug("Ignoring order from response with invalid id: " + id + " index not found. order: "+o.ToString());
return;
}
if (!_reslist[rid].isValid)
{
debug("Ignoring order from disabled response: " + _reslist[rid].Name + " order: " + o.ToString());
return;
}
if (_enableoversellprotect)
_ost.sendorder(o);
else
sendorder(o);
}