Beispiel #1
0
void conv_xml2ib( IB::TagValue* tV, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_STRING( tV, tag );
	GET_ATTR_STRING( tV, value );
}
Beispiel #2
0
void conv_xml2ib( IB::ComboLeg* cl, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_LONG( cl, conId );
	GET_ATTR_LONG( cl, ratio );
	GET_ATTR_STRING( cl, action );
	GET_ATTR_STRING( cl, exchange );
	GET_ATTR_LONG( cl, openClose );
	GET_ATTR_LONG( cl, shortSaleSlot );
	GET_ATTR_STRING( cl, designatedLocation );
	GET_ATTR_INT( cl, exemptCode );
}
Beispiel #3
0
static int
BufferSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
{
	GET_ATTR_STRING(name, nameobj);

	return BufferSetattr((BufferObject *)(self), name, val);
}
Beispiel #4
0
static int
WindowSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
{
	GET_ATTR_STRING(name, nameobj);

	return WindowSetattr((WindowObject *)(self), name, val);
}
Beispiel #5
0
void from_xml( AccStatusRequest *aR, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_BOOL( aR, subscribe );
	GET_ATTR_STRING( aR, acctCode );
}
Beispiel #6
0
static int
OutputSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
{
	GET_ATTR_STRING(name, nameobj);

	return OutputSetattr((OutputObject *)(self), name, val);
}
Beispiel #7
0
void from_xml( HistRequest *hR, const xmlNodePtr node )
{
	char* tmp;

	for( xmlNodePtr p = node->children; p!= NULL; p=p->next) {
		if( p->type == XML_ELEMENT_NODE
			&& strcmp((char*)p->name, "reqContract") == 0 )  {
			conv_xml2ib( &hR->ibContract, p);
		}
	}

	GET_ATTR_STRING( hR, endDateTime );
	GET_ATTR_STRING( hR, durationStr );
	GET_ATTR_STRING( hR, barSizeSetting );
	GET_ATTR_STRING( hR, whatToShow );
	GET_ATTR_INT( hR, useRTH );
	GET_ATTR_INT( hR, formatDate );
}
Beispiel #8
0
/* Current items object - Implementation
 */
static PyObject *
CurrentGetattro(PyObject *self, PyObject *nameobj)
{
	PyObject	*r;
	GET_ATTR_STRING(name, nameobj);
	if (!(r = CurrentGetattr(self, name)))
		return PyObject_GenericGetAttr(self, nameobj);
	return r;
}
Beispiel #9
0
static PyObject *
OutputGetattro(PyObject *self, PyObject *nameobj)
{
	GET_ATTR_STRING(name, nameobj);

	if (strcmp(name, "softspace") == 0)
		return PyLong_FromLong(((OutputObject *)(self))->softspace);

	return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #10
0
static PyObject *
ListGetattro(PyObject *self, PyObject *nameobj)
{
	GET_ATTR_STRING(name, nameobj);

	if (strcmp(name, "locked") == 0)
		return PyLong_FromLong(((ListObject *) (self))->list->lv_lock);

	return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #11
0
static PyObject *
FunctionGetattro(PyObject *self, PyObject *nameobj)
{
	FunctionObject	*this = (FunctionObject *)(self);

	GET_ATTR_STRING(name, nameobj);

	if (strcmp(name, "name") == 0)
		return PyUnicode_FromString((char *)(this->name));

	return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #12
0
static PyObject *
RangeGetattro(PyObject *self, PyObject *nameobj)
{
	GET_ATTR_STRING(name, nameobj);

	if (strcmp(name, "start") == 0)
		return Py_BuildValue("n", ((RangeObject *)(self))->start - 1);
	else if (strcmp(name, "end") == 0)
		return Py_BuildValue("n", ((RangeObject *)(self))->end - 1);
	else
		return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #13
0
static PyObject *
DictionaryGetattro(PyObject *self, PyObject *nameobj)
{
	DictionaryObject	*this = ((DictionaryObject *) (self));

	GET_ATTR_STRING(name, nameobj);

	if (strcmp(name, "locked") == 0)
		return PyLong_FromLong(this->dict->dv_lock);
	else if (strcmp(name, "scope") == 0)
		return PyLong_FromLong(this->dict->dv_scope);

	return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #14
0
void from_xml( MktDataRequest* mdr, const xmlNodePtr node )
{
	char* tmp;

	for( xmlNodePtr p = node->children; p!= NULL; p=p->next) {
		if( p->type == XML_ELEMENT_NODE
			&& strcmp((char*)p->name, "reqContract") == 0 )  {
			conv_xml2ib( &mdr->ibContract, p);
		}
	}

	GET_ATTR_STRING( mdr, genericTicks );
	GET_ATTR_BOOL( mdr, snapshot );
}
Beispiel #15
0
void from_xml( RowHist *row, const xmlNodePtr node )
{
	char* tmp;
	*row = dflt_RowHist;

	GET_ATTR_STRING( row, date );
	GET_ATTR_DOUBLE( row, open );
	GET_ATTR_DOUBLE( row, high );
	GET_ATTR_DOUBLE( row, low );
	GET_ATTR_DOUBLE( row, close );
	GET_ATTR_INT( row, volume );
	GET_ATTR_INT( row, count );
	GET_ATTR_DOUBLE( row, WAP );
	GET_ATTR_BOOL( row, hasGaps );
}
Beispiel #16
0
void conv_xml2ib( IB::ExecutionFilter* eF, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_LONG( eF, m_clientId );
	GET_ATTR_STRING( eF, m_acctCode );
	GET_ATTR_STRING( eF, m_time );
	GET_ATTR_STRING( eF, m_symbol );
	GET_ATTR_STRING( eF, m_secType );
	GET_ATTR_STRING( eF, m_exchange );
	GET_ATTR_STRING( eF, m_side );
}
Beispiel #17
0
static PyObject *
WindowGetattro(PyObject *self, PyObject *nameobj)
{
	PyObject *r;

	GET_ATTR_STRING(name, nameobj);

	if ((r = WindowAttrValid((WindowObject *)(self), name)))
		return r;

	if (CheckWindow((WindowObject *)(self)))
		return NULL;

	r = WindowAttr((WindowObject *)(self), name);
	if (r || PyErr_Occurred())
		return r;
	else
		return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #18
0
static PyObject *
TabPageGetattro(PyObject *self, PyObject *nameobj)
{
	PyObject *r;

	GET_ATTR_STRING(name, nameobj);

	if ((r = TabPageAttrValid((TabPageObject *)(self), name)))
		return r;

	if (CheckTabPage((TabPageObject *)(self)))
		return NULL;

	r = TabPageAttr((TabPageObject *)(self), name);
	if (r || PyErr_Occurred())
		return r;
	else
		return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #19
0
static PyObject *
BufferGetattro(PyObject *self, PyObject *nameobj)
{
	PyObject *r;

	GET_ATTR_STRING(name, nameobj);

	if ((r = BufferAttrValid((BufferObject *)(self), name)))
		return r;

	if (CheckBuffer((BufferObject *)(self)))
		return NULL;

	r = BufferAttr((BufferObject *)(self), name);
	if (r || PyErr_Occurred())
		return r;
	else
		return PyObject_GenericGetAttr(self, nameobj);
}
Beispiel #20
0
void conv_xml2ib( IB::OrderState* os, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_STRING( os, status );
	GET_ATTR_STRING( os, initMargin );
	GET_ATTR_STRING( os, maintMargin );
	GET_ATTR_STRING( os, equityWithLoan );
	GET_ATTR_DOUBLE( os, commission );
	GET_ATTR_DOUBLE( os, minCommission );
	GET_ATTR_DOUBLE( os, maxCommission );
	GET_ATTR_STRING( os, commissionCurrency );
	GET_ATTR_STRING( os, warningText );
}
Beispiel #21
0
void conv_xml2ib( IB::Execution* e, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_STRING( e, execId );
	GET_ATTR_STRING( e, time );
	GET_ATTR_STRING( e, acctNumber );
	GET_ATTR_STRING( e, exchange );
	GET_ATTR_STRING( e, side );
	GET_ATTR_INT( e, shares );
	GET_ATTR_DOUBLE( e, price );
	GET_ATTR_INT( e, permId );
	GET_ATTR_LONG( e, clientId );
	GET_ATTR_LONG( e, orderId );
	GET_ATTR_INT( e, liquidation );
	GET_ATTR_INT( e, cumQty );
	GET_ATTR_DOUBLE( e, avgPrice );
	GET_ATTR_STRING( e, orderRef );
#if TWSAPI_IB_VERSION_NUMBER >= 967
	GET_ATTR_STRING( e, evRule );
	GET_ATTR_DOUBLE( e, evMultiplier );
#endif
}
Beispiel #22
0
static int
ListSetattro(PyObject *self, PyObject *nameobj, PyObject *val)
{
	GET_ATTR_STRING(name, nameobj);
	return ListSetattr((ListObject *)(self), name, val);
}
Beispiel #23
0
void conv_xml2ib( IB::Contract* c, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_LONG( c, conId );
	GET_ATTR_STRING( c, symbol );
	GET_ATTR_STRING( c, secType );
	GET_ATTR_STRING( c, expiry );
	GET_ATTR_DOUBLE( c, strike );
	GET_ATTR_STRING( c, right );
	GET_ATTR_STRING( c, multiplier );
	GET_ATTR_STRING( c, exchange );
	GET_ATTR_STRING( c, primaryExchange );
	GET_ATTR_STRING( c, currency );
	GET_ATTR_STRING( c, localSymbol );
	GET_ATTR_BOOL( c, includeExpired );
	GET_ATTR_STRING( c, secIdType );
	GET_ATTR_STRING( c, secId );
	GET_ATTR_STRING( c, comboLegsDescrip );

	for( xmlNodePtr p = node->children; p!= NULL; p=p->next) {
		if( p->type != XML_ELEMENT_NODE ) {
			continue;
		}
		if( strcmp((char*) p->name, "comboLegs") == 0 ) {
#if TWSAPI_IB_VERSION_NUMBER <= 966
			if( c->comboLegs != NULL ) {
				/* see comment for underComp below */
				delete c->comboLegs;
			}
			c->comboLegs = new IB::Contract::ComboLegList();
#else
			c->comboLegs = IB::Contract::ComboLegListSPtr(
				new IB::Contract::ComboLegList() );
#endif
			for( xmlNodePtr q = p->children; q!= NULL; q=q->next) {
				if( q->type != XML_ELEMENT_NODE
					|| (strcmp((char*) q->name, "comboLeg") != 0)) {
					continue;
				}
				IB::ComboLeg *cl = new IB::ComboLeg();
				conv_xml2ib( cl, q );
#if TWSAPI_IB_VERSION_NUMBER <= 966
				c->comboLegs->push_back(cl);
#else
				c->comboLegs->push_back(IB::ComboLegSPtr(cl));
#endif
			}
		} else if( strcmp((char*) p->name, "underComp") == 0 ) {
			if( c->underComp != NULL ) {
				/* This can only happen if the caller gave us an uninitialized
				   contract (programming error) or if the xml wrongly contains
				   more than one underComp tag. For the second case we have to
				   avoid a memleak here */
				delete c->underComp;
			}
			c->underComp = new IB::UnderComp();
			conv_xml2ib( c->underComp, p );
		}
	}
}
Beispiel #24
0
static int
DictionarySetattro(PyObject *self, PyObject *nameobj, PyObject *val)
{
	GET_ATTR_STRING(name, nameobj);
	return DictionarySetattr((DictionaryObject *)(self), name, val);
}
Beispiel #25
0
static int
CurrentSetattro(PyObject *self, PyObject *nameobj, PyObject *value)
{
	GET_ATTR_STRING(name, nameobj);
	return CurrentSetattr(self, name, value);
}
Beispiel #26
0
void conv_xml2ib( IB::ContractDetails* cd, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_STRING( cd, marketName );
	GET_ATTR_STRING( cd, tradingClass );
	GET_ATTR_DOUBLE( cd, minTick );
	GET_ATTR_STRING( cd, orderTypes );
	GET_ATTR_STRING( cd, validExchanges );
	GET_ATTR_LONG( cd, priceMagnifier );
	GET_ATTR_INT( cd, underConId );
	GET_ATTR_STRING( cd, longName );
	GET_ATTR_STRING( cd, contractMonth );
	GET_ATTR_STRING( cd, industry );
	GET_ATTR_STRING( cd, category );
	GET_ATTR_STRING( cd, subcategory );
	GET_ATTR_STRING( cd, timeZoneId );
	GET_ATTR_STRING( cd, tradingHours );
	GET_ATTR_STRING( cd, liquidHours );
#if TWSAPI_IB_VERSION_NUMBER >= 967
	GET_ATTR_STRING( cd, evRule );
	GET_ATTR_DOUBLE( cd, evMultiplier );
#endif
	// BOND values
	GET_ATTR_STRING( cd, cusip );
	GET_ATTR_STRING( cd, ratings );
	GET_ATTR_STRING( cd, descAppend );
	GET_ATTR_STRING( cd, bondType );
	GET_ATTR_STRING( cd, couponType );
	GET_ATTR_BOOL( cd, callable );
	GET_ATTR_BOOL( cd, putable );
	GET_ATTR_DOUBLE( cd, coupon );
	GET_ATTR_BOOL( cd, convertible );
	GET_ATTR_STRING( cd, maturity );
	GET_ATTR_STRING( cd, issueDate );
	GET_ATTR_STRING( cd, nextOptionDate );
	GET_ATTR_STRING( cd, nextOptionType );
	GET_ATTR_BOOL( cd, nextOptionPartial );
	GET_ATTR_STRING( cd, notes );

	for( xmlNodePtr p = node->children; p!= NULL; p=p->next) {
		if( p->type != XML_ELEMENT_NODE ) {
			continue;
		}
		if( strcmp((char*) p->name, "summary") == 0 ) {
			conv_xml2ib( &cd->summary, p );
		}
#if TWSAPI_IB_VERSION_NUMBER >= 967
		else if(p->name && (strcmp((char*) p->name, "secIdList") == 0)) {
			GET_CHILD_TAGVALUELIST( cd->secIdList );
		}
#endif
	}
}
Beispiel #27
0
void conv_xml2ib( IB::Order* o, const xmlNodePtr node )
{
	char* tmp;

	GET_ATTR_LONG( o, orderId );
	GET_ATTR_LONG( o, clientId );
	GET_ATTR_LONG( o, permId );
	GET_ATTR_STRING( o, action );
	GET_ATTR_LONG( o, totalQuantity );
	GET_ATTR_STRING( o, orderType );
	GET_ATTR_DOUBLE( o, lmtPrice );
	GET_ATTR_DOUBLE( o, auxPrice );
	GET_ATTR_STRING( o, tif );
	GET_ATTR_STRING( o, ocaGroup );
	GET_ATTR_INT( o, ocaType );
	GET_ATTR_STRING( o, orderRef );
	GET_ATTR_BOOL( o, transmit );
	GET_ATTR_LONG( o, parentId );
	GET_ATTR_BOOL( o, blockOrder );
	GET_ATTR_BOOL( o, sweepToFill );
	GET_ATTR_INT( o, displaySize );
	GET_ATTR_INT( o, triggerMethod );
	GET_ATTR_BOOL( o, outsideRth );
	GET_ATTR_BOOL( o, hidden );
	GET_ATTR_STRING( o, goodAfterTime );
	GET_ATTR_STRING( o, goodTillDate );
	GET_ATTR_STRING( o, rule80A );
	GET_ATTR_BOOL( o, allOrNone );
	GET_ATTR_INT( o, minQty );
	GET_ATTR_DOUBLE( o, percentOffset );
	GET_ATTR_BOOL( o, overridePercentageConstraints );
	GET_ATTR_DOUBLE( o, trailStopPrice );
#if TWSAPI_IB_VERSION_NUMBER >= 967
	GET_ATTR_DOUBLE( o, trailingPercent );
#endif
	GET_ATTR_STRING( o, faGroup );
	GET_ATTR_STRING( o, faProfile );
	GET_ATTR_STRING( o, faMethod );
	GET_ATTR_STRING( o, faPercentage );
	GET_ATTR_STRING( o, openClose );

	tmp = (char*) xmlGetProp( node, (xmlChar*) "origin" );
	if(tmp) {
		int orderOriginInt = atoi( tmp );
		free(tmp);
		o->origin = (IB::Origin) orderOriginInt;
	}
	GET_ATTR_INT( o, shortSaleSlot );
	GET_ATTR_STRING( o, designatedLocation );
	GET_ATTR_INT( o, exemptCode );
	GET_ATTR_DOUBLE( o, discretionaryAmt );
	GET_ATTR_BOOL( o, eTradeOnly );
	GET_ATTR_BOOL( o, firmQuoteOnly );
	GET_ATTR_DOUBLE( o, nbboPriceCap );
	GET_ATTR_BOOL( o, optOutSmartRouting );
	GET_ATTR_INT( o, auctionStrategy );
	GET_ATTR_DOUBLE( o, startingPrice );
	GET_ATTR_DOUBLE( o, stockRefPrice );
	GET_ATTR_DOUBLE( o, delta );
	GET_ATTR_DOUBLE( o, stockRangeLower );
	GET_ATTR_DOUBLE( o, stockRangeUpper );
	GET_ATTR_DOUBLE( o, volatility );
	GET_ATTR_INT( o, volatilityType );
	GET_ATTR_STRING( o,  deltaNeutralOrderType );
	GET_ATTR_DOUBLE( o, deltaNeutralAuxPrice );
	GET_ATTR_LONG( o, deltaNeutralConId );
	GET_ATTR_STRING( o, deltaNeutralSettlingFirm );
	GET_ATTR_STRING( o, deltaNeutralClearingAccount );
	GET_ATTR_STRING( o, deltaNeutralClearingIntent );
#if TWSAPI_IB_VERSION_NUMBER >= 968
	GET_ATTR_STRING( o, deltaNeutralOpenClose );
	GET_ATTR_BOOL( o, deltaNeutralShortSale );
	GET_ATTR_INT( o, deltaNeutralShortSaleSlot );
	GET_ATTR_STRING( o, deltaNeutralDesignatedLocation );
#endif
	GET_ATTR_BOOL( o, continuousUpdate );
	GET_ATTR_INT( o, referencePriceType );
	GET_ATTR_DOUBLE( o, basisPoints );
	GET_ATTR_INT( o, basisPointsType );
	GET_ATTR_INT( o, scaleInitLevelSize );
	GET_ATTR_INT( o, scaleSubsLevelSize );
	GET_ATTR_DOUBLE( o, scalePriceIncrement );
#if TWSAPI_IB_VERSION_NUMBER >= 967
	GET_ATTR_DOUBLE( o, scalePriceAdjustValue );
	GET_ATTR_INT( o, scalePriceAdjustInterval );
	GET_ATTR_DOUBLE( o, scaleProfitOffset );
	GET_ATTR_BOOL( o, scaleAutoReset );
	GET_ATTR_INT( o, scaleInitPosition );
	GET_ATTR_INT( o, scaleInitFillQty );
	GET_ATTR_BOOL( o, scaleRandomPercent );
#endif
	GET_ATTR_STRING( o, hedgeType );
	GET_ATTR_STRING( o, hedgeParam );
	GET_ATTR_STRING( o, account );
	GET_ATTR_STRING( o, settlingFirm );
	GET_ATTR_STRING( o, clearingAccount );
	GET_ATTR_STRING( o, clearingIntent );
	GET_ATTR_STRING( o, algoStrategy );
	GET_ATTR_BOOL( o, whatIf );
	GET_ATTR_BOOL( o, notHeld );

	for( xmlNodePtr p = node->children; p!= NULL; p=p->next) {
		if( p->type != XML_ELEMENT_NODE ) {
			continue;
		}
		if( strcmp((char*) p->name, "algoParams") == 0 ) {
			GET_CHILD_TAGVALUELIST( o->algoParams );
		} else if( strcmp((char*) p->name, "smartComboRoutingParams") == 0 ) {
			GET_CHILD_TAGVALUELIST( o->smartComboRoutingParams );
		}
#if TWSAPI_IB_VERSION_NUMBER >= 967
		else if( strcmp((char*) p->name, "orderComboLegs") == 0 ) {
			o->orderComboLegs = IB::Order::OrderComboLegListSPtr(
				new IB::Order::OrderComboLegList() );
			for( xmlNodePtr q = p->children; q!= NULL; q=q->next) {
				IB::OrderComboLegSPtr oCL( new IB::OrderComboLeg());
				if( q->type != XML_ELEMENT_NODE
				    || (strcmp((char*) q->name, "orderComboLeg") != 0)) {
					continue;
				}
				conv_xml2ib( oCL.get(), q );
				o->orderComboLegs->push_back(oCL);
			}
		}
#endif
	}
}