Cant load real-time data from tws - interactive-brokers

I can't get real-time tick with API for GBP.CHF#IDEALPRO/ My log:
0:53:36:282 <- 9-8-1073741829-0-GBP-CASH--0-----CHF---0---
10:53:36:282 <- 1-11-1073741830-0-GBP-CASH--0-----CHF---0-233,236,258-0-0--
10:53:36:282 -> ---R4-2-1073741830-321-Error validating request.-'bX' : cause - Please enter exchange-
10:53:36:283 <- 1-11--1073741830-0-GBP-CASH--0-----CHF---0--1-0--
10:53:36:283 -> ---S4-2--1073741830-321-Error validating request.-'bX' : cause - Please enter exchange-
10:53:36:318 <- 9-8-1073741831-0-GBP-CASH--0-----CHF---0---
Nothing incoming from tws. Please help.

Here's your log compared to my log.
1-11-1073741830-0-GBP-CASH--0 --- --CHF---0-233,236,258-0-0--
1-11-1 -0-GBP-CASH--0.0---IDEALPRO--CHF---0-233-0-0--
You just forgot the exchange.
contract = Contract()
contract.symbol = "GBP"
contract.secType = "CASH"
contract.exchange = "IDEALPRO"
contract.currency = "CHF"
app.reqMktData(1, contract, "233", False, False, None)
I'm not sure about your generic tick list, not all type are available for forex. I just threw in 233 to see if it would cause an error but it worked.

Related

Trying to use add = True and I get an error message

I am Trying to use add = True and I get an error message. How can I do it?
This is my code
quadratcount(schools.pp)
plot(schools.sp, col = "red")
plot(quadratcount(schools.pp), add= T)`
and this is the error message I get
Error in (function (x, y = NULL, density = NULL, angle = 45, border = NULL, : plot.new has not been called yet
Looks like you made a simple typo: In the first plot command you write plot(schools.sp, col = "red"), where you probably meant plot(schools.pp, col = "red"). For future questions please provide a reproducible example where we can run each line including library(spatstat) and the definition of schools.pp etc. If you can't share your data just either:
use the first few points of your data
use a built-in dataset
generate artificial data

Why cyrsasl_scram mechanism is not allowing base64 GUID?

I am writing a chat communication app.
If the user's unique id is given in Base 64 GUID format, it is throwing bad_username error.
In this file: https://pow.gs/mirror/ejabberd/-/blob/fd8e07af4789be362a61755ea47f216baeb64989/src/cyrsasl_scram.erl, there is a method to remove the == from username:
unescape_username(<<"">>) -> <<"">>;
unescape_username(EscapedUsername) ->
Pos = str:str(EscapedUsername, <<"=">>),
if Pos == 0 -> EscapedUsername;
true ->
Start = str:substr(EscapedUsername, 1, Pos - 1),
End = str:substr(EscapedUsername, Pos),
EndLen = byte_size(End),
if EndLen < 3 -> error;
true ->
case str:substr(End, 1, 3) of
<<"=2C">> ->
<<Start/binary, ",",
(unescape_username(str:substr(End, 4)))/binary>>;
<<"=3D">> ->
<<Start/binary, "=",
(unescape_username(str:substr(End, 4)))/binary>>;
_Else -> error
end
end
end.
I don't know why this has been written. If I remove this particular code, the connection is working fine. Please let me know why it is restricted.
If the users' unique id is given in Base 64 GUID format, it is throwing bad_username error.
Right:
call xmpp_sasl_scram:unescape_username(<<"user1">>)
returned from xmpp_sasl_scram:unescape_username/1 -> <<"user1">>
call xmpp_sasl_scram:unescape_username(<<"user3==ABC">>)
returned from xmpp_sasl_scram:unescape_username/1 -> error
call xmpp_sasl_scram:unescape_username(<<"user4=DEF">>)
returned from xmpp_sasl_scram:unescape_username/1 -> error
call xmpp_sasl_scram:unescape_username(<<"user5=">>)
returned from xmpp_sasl_scram:unescape_username/1 -> error
I don't know why this has been written. If I remove this particular code, the connection is working fine. Please let me know why it is restricted.
I don't know, either. But that code exists since nine years ago:
https://github.com/processone/ejabberd/commit/e80b92b48148505b44c6a378db36badfe60fce79#diff-5c51943c1268ffe26fe3b041b20675c6R136
Whatever reason there is for it, it's obviously a good reason.

Ejabberd - Route message to users in offline_message_hook

I want to build a customer support chat app. There are users and an admin. Below admin there are multiple sub-admins. Initially the chat is initiated with admin only, but if the admin is offline I need to route the message to sub-admins.
offline_message_hook hook serves the purpose. I'll check if the To is admin, then I need to route the Packet to one of the sub-admins. How do I route/send the packet to other user within offline_message_hook. In short how do I change the To from the packet so that the packet is re-directed to the new sub-admin?
Here is what I've tried:-
offline_message_hook({_Action, #message{from = Peer, to = To} = Pkt} = Acc) ->
?INFO_MSG("Inside offline", []),
ejabberd_router:route(From, To, Packet),
ok.
I'm using ejabberd 17.04.105.
Update
After following user2610053's advice, I did this:-
-spec offline_message_hook({any(), message()}) -> {any(), message()}.
offline_message_hook({_Action, Msg} = Acc) ->
ejabberd_router:route(xmpp:set_to(Msg, 'praful#localhost')),
{routed, Msg}.
Following is the error:-
15:13:12.291 [error] failed to route packet:
#message{id = <<"purple187f6502">>,type = chat,lang = <<"en">>,
from = {jid,<<"praful2">>,<<"localhost">>,<<"Prafuls-MacBook-Pro">>,
<<"praful2">>,<<"localhost">>,<<"Prafuls-MacBook-Pro">>},
to = praful#localhost,subject = [],
body = [#text{lang = <<>>,data = <<"co=umon">>}],
thread = undefined,
sub_els = [{xmlel,<<"active">>,
[{<<"xmlns">>,
<<"http://jabber.org/protocol/chatstates">>}],
[]}],
meta = #{ip => {0,0,0,0,0,0,0,1}}}
Reason = {error,{{badrecord,jid},[{ejabberd_router,do_route,1,[{file,"src/ejabberd_router.erl"},{line,343}]},{ejabberd_router,route,1,[{file,"src/ejabberd_router.erl"},{line,87}]},{mod_sunshine,offline_message_hook,1,[{file,"src/mod_sunshine.erl"},{line,24}]},{ejabberd_hooks,safe_apply,4,[{file,"src/ejabberd_hooks.erl"},{line,380}]},{ejabberd_hooks,run_fold1,4,[{file,"src/ejabberd_hooks.erl"},{line,364}]},{ejabberd_sm,route,1,[{file,"src/ejabberd_sm.erl"},{line,138}]},{ejabberd_local,route,1,[{file,"src/ejabberd_local.erl"},{line,116}]},{ejabberd_router,do_route,1,[{file,"src/ejabberd_router.erl"},{line,348}]}]}}
The user praful#localhost exist. Please advice what exactly is wrong?
Update2 - `UserReceivePacket Hook
In user_receive_packet packet hook, upon using the same function ejabberd_router:route(xmpp:set_to(Packet, jid:decode("praful#localhost"))), it throws an error saying :-
Hook user_receive_packet crashed when running mod_sunshine:user_receive_packet/1:
** Reason = {error,function_clause,[{jid,decode,[{file,"src/jid.erl"},{line,132}],["praful#localhost"]},{mod_sunshine,user_receive_packet,[{file,"src/mod_sunshine.erl"},{line,29}],1},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{ejabberd_c2s,process_info,[{file,"src/ejabberd_c2s.erl"},{line,231}],2},{ejabberd_hooks,safe_apply,[{file,"src/ejabberd_hooks.erl"},{line,380}],4},{ejabberd_hooks,run_fold1,[{file,"src/ejabberd_hooks.erl"},{line,364}],4},{xmpp_stream_in,handle_info,[{file,"src/xmpp_stream_in.erl"},{line,373}],2}]}
So, I read about function_clause, but couldnt understand the same. What exactly is wrong over here?
I think you're asking about xmpp:set_to/2. Here is an example:
offline_message_hook({_Action, Msg} = Acc) ->
SubAdmins = get_sub_admins(Msg#message.to),
lists:foreach(
fun(Admin) ->
ejabberd_router:route(xmpp:set_to(Msg, Admin))
end, Admins),
{routed, Msg}.

FedEx error: Special service invalid 8200

I'm trying to connect to FedEx International WebServices API for Ship Service.
I'm using WSDL of v13.
Below is my SOAP Content:
<ns:ProcessShipmentRequest xmlns:ns="http://fedex.com/ws/ship/v13">
<ns:WebAuthenticationDetail>
<ns:UserCredential>
<ns:Key>GHmnVXAyWqWUemqD</ns:Key>
<ns:Password>1VYHs6O1vhKA3xPVAExhx1vUB</ns:Password>
</ns:UserCredential>
</ns:WebAuthenticationDetail>
<ns:ClientDetail>
<ns:AccountNumber>510087666</ns:AccountNumber>
<ns:MeterNumber>100115929</ns:MeterNumber>
</ns:ClientDetail>
<ns:Version>
<ns:ServiceId>ship</ns:ServiceId>
<ns:Major>13</ns:Major>
<ns:Intermediate>0</ns:Intermediate>
<ns:Minor>0</ns:Minor>
</ns:Version>
<ns:RequestedShipment>
<ns:ShipTimestamp>2015-04-17T12:51:03.404660Z</ns:ShipTimestamp>
<ns:DropoffType>REGULAR_PICKUP</ns:DropoffType>
<ns:ServiceType>INTERNATIONAL_PRIORITY</ns:ServiceType>
<ns:PackagingType>FEDEX_25KG_BOX</ns:PackagingType>
<ns:TotalWeight>
<ns:Units>LB</ns:Units>
<ns:Value>40.0</ns:Value>
</ns:TotalWeight>
<ns:Shipper>
<ns:Contact>
<ns:CompanyName>Your Company</ns:CompanyName>
<ns:PhoneNumber>4354454365746</ns:PhoneNumber>
</ns:Contact>
<ns:Address>
<ns:StreetLines>3121 W Government Way</ns:StreetLines>
<ns:StreetLines>Seattle</ns:StreetLines>
<ns:City>Seattle</ns:City>
<ns:StateOrProvinceCode>WA</ns:StateOrProvinceCode>
<ns:PostalCode>98199</ns:PostalCode>
<ns:CountryCode>US</ns:CountryCode>
<ns:CountryName>United States</ns:CountryName>
<ns:Residential>false</ns:Residential>
</ns:Address>
</ns:Shipper>
<ns:Recipient>
<ns:Contact>
<ns:PersonName>Agrolait</ns:PersonName>
<ns:PhoneNumber>3210588558</ns:PhoneNumber>
</ns:Contact>
<ns:Address>
<ns:StreetLines>1010 EASY ST</ns:StreetLines>
<ns:StreetLines>Apt# 11</ns:StreetLines>
<ns:City>OTTAWA</ns:City>
<ns:StateOrProvinceCode>ON</ns:StateOrProvinceCode>
<ns:PostalCode>K1A0B1</ns:PostalCode>
<ns:CountryCode>CA</ns:CountryCode>
<ns:Residential>false</ns:Residential>
</ns:Address>
</ns:Recipient>
<ns:ShippingChargesPayment>
<ns:PaymentType>SENDER</ns:PaymentType>
<ns:Payor>
<ns:ResponsibleParty>
<ns:AccountNumber>510087666</ns:AccountNumber>
<ns:Contact>
<ns:PersonName>Your Company</ns:PersonName>
<ns:CompanyName>Your Company</ns:CompanyName>
<ns:PhoneNumber>4354454365746</ns:PhoneNumber>
</ns:Contact>
<ns:Address>
<ns:CountryCode>US</ns:CountryCode>
</ns:Address>
</ns:ResponsibleParty>
</ns:Payor>
</ns:ShippingChargesPayment>
<ns:CustomsClearanceDetail>
<ns:ClearanceBrokerage>BROKER_UNASSIGNED</ns:ClearanceBrokerage>
<ns:DutiesPayment>
<ns:PaymentType>SENDER</ns:PaymentType>
<ns:Payor>
<ns:ResponsibleParty>
<ns:AccountNumber>510087666</ns:AccountNumber>
<ns:Contact>
<ns:PersonName>Your Company</ns:PersonName>
<ns:CompanyName>Your Company</ns:CompanyName>
<ns:PhoneNumber>4354454365746</ns:PhoneNumber>
</ns:Contact>
</ns:ResponsibleParty>
</ns:Payor>
</ns:DutiesPayment>
<ns:DocumentContent>NON_DOCUMENTS</ns:DocumentContent>
<ns:CustomsValue>
<ns:Currency>USD</ns:Currency>
<ns:Amount>100.0</ns:Amount>
</ns:CustomsValue>
<ns:FreightOnValue>OWN_RISK</ns:FreightOnValue>
<ns:CommercialInvoice>
<ns:TaxesOrMiscellaneousChargeType>TAXES</ns:TaxesOrMiscellaneousChargeType>
<ns:Purpose>SOLD</ns:Purpose>
<ns:TermsOfSale>FOB_OR_FCA</ns:TermsOfSale>
</ns:CommercialInvoice>
<ns:Commodities>
<ns:NumberOfPieces>1</ns:NumberOfPieces>
<ns:Description>[CARD] Graphics Card</ns:Description>
<ns:CountryOfManufacture>US</ns:CountryOfManufacture>
<ns:Weight>
<ns:Units>LB</ns:Units>
<ns:Value>10.0</ns:Value>
</ns:Weight>
<ns:Quantity>1</ns:Quantity>
<ns:QuantityUnits>Unit(s)</ns:QuantityUnits>
<ns:UnitPrice>
<ns:Currency>USD</ns:Currency>
<ns:Amount>100.0</ns:Amount>
</ns:UnitPrice>
<ns:CustomsValue>
<ns:Currency>USD</ns:Currency>
<ns:Amount>100.0</ns:Amount>
</ns:CustomsValue>
</ns:Commodities>
</ns:CustomsClearanceDetail>
<ns:LabelSpecification>
<ns:LabelFormatType>COMMON2D</ns:LabelFormatType>
<ns:ImageType>PNG</ns:ImageType>
<ns:LabelStockType>PAPER_4X6</ns:LabelStockType>
<ns:LabelPrintingOrientation>BOTTOM_EDGE_OF_TEXT_FIRST</ns:LabelPrintingOrientation>
</ns:LabelSpecification>
<ns:ShippingDocumentSpecification>
<ns:ShippingDocumentTypes>CERTIFICATE_OF_ORIGIN</ns:ShippingDocumentTypes>
</ns:ShippingDocumentSpecification>
<ns:RateRequestTypes>ACCOUNT</ns:RateRequestTypes>
<ns:EdtRequestType>ALL</ns:EdtRequestType>
<ns:PackageCount>1</ns:PackageCount>
<ns:RequestedPackageLineItems>
<ns:SequenceNumber>1</ns:SequenceNumber>
<ns:Weight>
<ns:Units>LB</ns:Units>
<ns:Value>40.0</ns:Value>
</ns:Weight>
<ns:Dimensions>
<ns:Length>17</ns:Length>
<ns:Width>12</ns:Width>
<ns:Height>3</ns:Height>
<ns:Units>IN</ns:Units>
</ns:Dimensions>
<ns:PhysicalPackaging>BOX</ns:PhysicalPackaging>
</ns:RequestedPackageLineItems>
</ns:RequestedShipment>
</ns:ProcessShipmentRequest>
When I send the request I get Below Response:
(reply){
HighestSeverity = "ERROR"
Notifications[] =
(Notification){
Severity = "ERROR"
Source = "ship"
Code = "8200"
Message = "Special service is invalid."
LocalizedMessage = "Special service is invalid."
},
(Notification){
Severity = "WARNING"
Source = "ship"
Code = "7037"
Message = "Harmonized code is missing or invalid for commodity (COMMODITY_INDEX}; estimated duties and taxes were not returned."
LocalizedMessage = "Harmonized code is missing or invalid for commodity (COMMODITY_INDEX}; estimated duties and taxes were not returned."
MessageParameters[] =
(NotificationParameter){
Id = "COMMODITY_INDEX"
Value = "1"
},
},
Version =
(VersionId){
ServiceId = "ship"
Major = 13
Intermediate = 0
Minor = 0
}
}
Warning I can have fixed but the Special Service Invalid Error Persists. Please let me know If I'm passing some wrong value or if I'm missing some Value.
Note: I tried adding the special services like COD, but the issue is same.
Since you don't have a special service defined, this error is really odd. You need to email websupport at fedex dot com for resolution. FedEx error responses are terrible.

LSXLC ODBC Stored Procedure

I'm trying to connect to an Oracle RDB database using LSXLC (ODBC Connector).
But when it comes to stored procedures I'm having a hard time getting it to work.
The code below always results in "Error: Parameter name not supplied: fnl_date, Connector 'odbc2', Method -Call-". The error is triggered on "count = connection.Call(input, 1, result)"
Can anyone tell me what I'm doing wrong?
Public Function testLsxlcProc()
On Error GoTo handleError
Dim connection As LCConnection("odbc2")
connection.Server = "source"
connection.Userid = "userid"
connection.Password = "password"
connection.procedure = "proc_name"
connection.Connect
If connection.IsConnected Then
Dim input As New LCFieldList()
Dim result As New LCFieldList()
Dim break As LCField
Set break = input.Append("fnl_date", LCTYPE_TEXT)
break.Text = "2014-07-01"
Dim agrNo As LCField
Set agrNo = input.Append("fnl_agreement_no", LCTYPE_TEXT)
agrNo.Text = "123456"
Dim curr As LCField
Set curr = input.Append("fnl_currency_code", LCTYPE_TEXT)
curr.Text = "SEK"
Dim stock As LCField
Set stock = input.Append("fnl_stock_id", LCTYPE_TEXT)
stock.Text = "01"
connection.Fieldnames = "status, value"
Dim count As Integer
count = connection.Call(input, 1, result)
Call logger.debug("Count: " & count)
Else
Error 2000, "Unable to connect to database."
End If
handleExit:
connection.Disconnect
Exit Function
handleError:
On Error Resume Next
Call logger.error(Nothing)
Resume handleExit
End Function
Thanks in advance!
I had made a stupid mistake and had a mismatch between the name of the input parameter in Domino and the name of the input parameter in the stored procedure.
Make sure all names match up and there shouldn't be a problem.
Stored-Procedure "mylib.MyStoredProc" wird aufgerufen ...
LcSession.Status = 12325: LC-Error: errCallStoredProc 12325 (Error: Parameter name not supplied: P_S651_AC, Connector 'odbc2', Method -Call-)
Solution: changed "mylib" into "MYLIB" and all was well.
Check not only Parameter-Names, but also the Search-Path.

Resources