I'm pretty new in quickfix, I've tried to read a lot and learn as much as I've could. But I'm facing a weird problem which I've could fix but I cannot understand why it's not working as expected.
First, my venue requires username and password, so I add both to 35=A message. This is expected, what it's not expected it's having field 141 automatically set in logon message, even when in cfg file this is not included, or at least not on purpose. And similar to SenderSubID, TargetCompID and TargetSubID which are required to my venue and having included them in config file are not considered in automatically generated Logon. What I'm doing in a wrong way? Maybe I'm using an incorrect AppDataDictionary, maybe I should change it to customize? Not sure how to fix this in a more smart way instead of using toAdmin to customize a lot of message fields which should be properly generated before.
Code snippet to fix the problem I'm facing
def toAdmin(self, message, sessionID):
# Hook que corre antes de enviar un mensaje al servidor fix
msg_type = fix.MsgType()
message.getHeader().getField(msg_type)
if msg_type.getString() is fix.MsgType_Logon:
message.removeField(141)
message.getHeader().setField(fix.StringField(34, "1"))
message.getHeader().setField(fix.SenderSubID("351"))
message.getHeader().setField(fix.StringField(1408, "T5.0"))
message.getHeader().setField(fix.TargetCompID("XXX"))
message.getHeader().setField(fix.TargetSubID("M3"))
message.setField(fix.Username("xxxxxxx"))
message.setField(fix.Password("xxxxxxx"))
This is my configuration file
[SESSION]
StartTime=00:00:00
SenderCompID=A899
SenderSubID=351
EndTime=00:00:00
ConnectionType=initiator
ApplVerID=9
BeginString=FIXT.1.1
DefaultApplVerID=9
TransportDataDictionary=FIXT11.xml
AppDataDictionary=FIXT11.xml
TargetCompID=XXX
TargetSubID=M3
SocketConnectPort=xxxx
SocketConnectHost=xx.xx.xx.xx
SocketUseSSL=Y
SSLEnable=Y
HeartBtInt=20
ReconnectInterval=30
ResetOnLogout=Y
ResetOnDisconnect=Y
SSLValidateCertificates=Y
ResetSeqNumFlag=N
Thanks a lot for your help, any idea would be welcome.
Regards
I think appart of removing ResetOn... not much more can be done. I've researched for same request in other languages (c#, Java and c) and proposal solution is always which I did. So I assume this is the best approach :(
Thanks a lot for your time and help.
Related
Im developing a bot in c++ using QuickFix, when I send a Logon message I get a logout response saying "Invalid user for session. Username and SenderCompId must match"
This is my message:
8=FIXT.1.1|9=113|35=A|34=1|49=REM4820|52=20201008-22:22:59.886|56=ROFX|553=User|554=pass|98=0|108=30|141=Y|1137=9|10=054|
(User and pass changed for privacy reasons)
This is the response:
8=FIXT.1.1|9=135|35=5|34=1|49=ROFX|52=20201008-22:33:00.356|56=REM4820|1128=9|58=Invalid user for session. Username and SenderCompId must match.|1409=1|10=124|
Things I've tried:
I've downloaded this python project and used it to connect with Remarkets getting the same result. (and the same logon message being sent)
Interchange SenderCompID and TargetCompID as i saw in another post that it helped someone.
Make new users with new passwords to try different accounts, same results.
Not sending user and password as Remarkets documentation states it's not necessary: no response from host
Played with SSL configuration. I'm using Stunnel4, but I assume that if "Username and SenderCompId must match" the Acceptor must be receiving and reading my message.
Ignore SSL and connect directly: Connection reset by peer.
My first and most important quiestion is: What am I doing wrong?
Another questions that might really help:
Is there a way for me to connect (OS:ubuntu) using a nice GUI #OrNot and checking FIX message to see the difference between a message that connects and mine that doesn't? Those were my intentions with python but i got the same result.
Does someone know about a Remarkets Alternative, blaming it on remarkets is like blaming it on the compiler but I need to check.
Why does the server answers field 58 with an explanation but sometimes i get "Connection reset by peer"?
Client.conf
[DEFAULT]
PersistMessages=Y
ConnectionType=initiator
ReconnectInterval=60
FileLogPath=./Logs/
FileStorePath=./Sessions/
UseLocalTime=Y
UseDataDictionary=Y
AppDataDictionary=conf/spec/FIX50SP2_rofex.xml
TransportDataDictionary=conf/spec/FIXT11.xml
StartTime=00:00:00
EndTime=00:00:00
ValidateUserDefinedFields=N
ResetOnLogon=Y
ResetOnLogout=Y
DefaultApplVerID=FIX.5.0SP2
[SESSION]
BeginString=FIXT.1.1
SenderCompID=REM4820
TargetCompID=ROFX
SocketConnectHost=127.0.0.1
SocketConnectPort=9876
HeartBtInt=30
TimeInForce=Day
TradingSessionID=1
ScreenLogShowIncoming=Y
ScreenLogShowOutgoing=Y
ScreenLogEvents=Y
LogoutTimeout=5
LogonTimeout=30
ResetOnDisconnect=Y
RefreshOnLogon=Y
SocketNodelay=N
ValidateFieldsHaveValues=N
ValidateFieldsOutofOrder=N
CheckLatency=N
This is definitely a counterparty-specific-logic problem, and not a FIX protocol problem.
Let's get extremely literal:
Username and SenderCompId must match.
Going by that message alone, it seems pretty clear that tag 49 (SenderCompID) and tag 553 (Username) must have the same value.
Did they? I'm guessing they didn't. Try setting 553 to match 49.
I am trying to delete features using the delete_features method on the FeatureLayer Object and I keep getting the following error: "This SqlTransaction has completed; it is no longer usable."
The code is below. The error message seems to populate in the last line where="OBJECTID >=0", but I'm not a 100 sure if this is the problem. Unfortunately I'm not very good at programming.
gis = arcgis.GIS("http://gfcgis.maps.arcgis.com", "UserName", "Password")
feature_layer_item = gis.content.search(FeatureLayer, item_type = 'Feature Service')[0]
flayers = feature_layer_item.layers
flayer = flayers[0]
flayer.delete_features(where="OBJECTID >= 0", rollback_on_failure=True)
Any help would be greatly appreciated.
Michael
This sounds like a zombie transaction. Check with your DBA if there's a query, most likely a Stored Procedure, which is being called when your code runs. This message usually shows up when the application code tries to do a commit on the DB after the SP has already committed.
That's the SQL Transaction which has already completed.
Come to find out, it was a simple syntax error causing the issue. I didn't put quotations around 'True' for the rollback_on_failure parameter.
I am trying to retrieve an event when a device registers an application using ARI. This can be assumed by changing the endpoint state from offline to online. The implementation that I have done in python is:
self.client.on_event ('DeviceStateChanged', self.deviceRegistration)
self.client.on_event ('PeerStatusChange', self.deviceRegistration)
self.client.on_event ('EndpointStateChange', self.deviceRegistration)
self.client.on_event ('ContactStatusChange', self.deviceRegistration)
and nothing works. Anybody can help ?
I have managed to find a way to solve it. The change of device state has listen by event EndpointStateChange. But before, we must subscribe our application to the stasis. Here the implementation :
self.client = ari.connect(.....)
self.client.applications.subscribe(applicationName="(our stasis name)",eventSource="endpoint:PJSIP")
self.client.on_endpoint_event('EndpointStateChange',self.handleDeviceRegister)
where the handleDeviceRegister method are:
def handleDeviceRegister(self, channel_obj,ev):
if channel_obj.json["state"]=="online":
print "channel change from off to online"
if anybody get another way please tell me. thanks
I have a problem with implementing django-channels with RabbitMQ channel layer. I'd finished RabbitMQ tutorial and ran through Vincent Zhang's example1 and few other examples without any problem, but stumbled upon the implementation of Andy Goodwin's example2 databinding example. The problem seems to be with Pika module.
At first, pika==0.10.0 raised the following exception:
pika.exceptions.ChannelClosed: (404, "NOT_FOUND - no exchange 'binding.enquirer' in vhost '/'")
After upgrading pika to 0.11.0b1 the exception changed to
ValueError: Must have completion callback with nowait=False
Tracing back to pika's source code (channel.py), it seems that the method responsible for canceling the consumer, basic_cancel, has the follwing parameters:
nowait==False
callback is None
which isn't acceptable by the program. I don't know how to solve this. Here's my code (nothing beyond Andy's example, really):
consumers.py
class Demultiplexer(WebsocketDemultiplexer):
consumers = {
"taxpayer": TaxpayerBinding.consumer,
}
groups = ["binding.enquirer"]
models.py
class Taxpayer(models.Model):
...
class TaxpayerBinding(WebsocketBinding):
model = Taxpayer
stream = "taxpayer"
fields = ["taxpayer_id", "checksum_status", "name"]
#classmethod
def group_names(cls, *args, **kwargs):
return ["binding.enquirer"]
def has_permission(self, user, action, pk):
return True
routing.py
channel_routing = [
route_class(Demultiplexer, path="^/binding/"),
The html template and javascript inside is a mess right now, so unless crucial to solving this problem, I'd rather not show it right now (I do not know js at all, so I'll probably ask someone for help or make it another question, but I don't want to mix the two topics if not related). Please let me know, if those problems are connected and I will edit this question.
P.S. I'm a newbie so I'd be glad for any comments that will allow me to better understand what is going on. The broader the answers, the better. Thanks.
See this GitHub issue: https://github.com/pika/pika/issues/925
Basically, if you set nowait=True you must set callback=None
I'm slowly building a web browser in PyQt4 and like the speed i'm getting out of it. However, I want to combine easylist.txt with it. I believe adblock uses this to block http requests by the browser.
How would you go about it using python/PyQt4?
[edit1] Ok. I think i've setup Privoxy. I haven't setup any additional filters and it seems to work. The PyQt4 i've tried to use looks like this
self.proxyIP = "127.0.0.1"
self.proxyPORT= 8118
proxy = QNetworkProxy()
proxy.setType(QNetworkProxy.HttpProxy)
proxy.setHostName(self.proxyIP)
proxy.setPort(self.proxyPORT)
QNetworkProxy.setApplicationProxy(proxy)
However, this does absolutely nothing and I cannot make sense of the docs and can not find any examples.
[edit2] I've just noticed that i'f I change self.proxyIP to my actual local IP rather than 127.0.0.1 the page doesn't load. So something is happening.
I know this is an old question, but I thought I'd try giving an answer for anyone who happens to stumble upon it. You could create a subclass of QNetworkAccessManager and combine it with https://github.com/atereshkin/abpy. Something kind of like this:
from PyQt4.QtNetwork import QNetworkAccessManager
from abpy import Filter
adblockFilter = Filter(file("easylist.txt"))
class MyNetworkAccessManager(QNetworkAccessManager):
def createRequest(self, op, request, device=None):
url = request.url().toString()
doFilter = adblockFilter.match(url)
if doFilter:
return QNetworkAccessManager.createRequest(self, self.GetOperation, QNetworkRequest(QUrl()))
else:
QNetworkAccessManager.createRequest(self, op, request, device)
myNetworkAccessManager = MyNetworkAccessManager()
After that, set the following on all your QWebView instances, or make a subclass of QWebView:
QWebView.page().setNetworkAccessManager(myNetworkAccessManager)
Hope this helps!
Is this question about web filtering?
Then try use some of external web-proxy, for sample Privoxy (http://en.wikipedia.org/wiki/Privoxy).
The easylist.txt file is simply plain text, as demonstrated here: http://adblockplus.mozdev.org/easylist/easylist.txt
lines beginning with [ and also ! appear to be comments, so it is simply a case of sorting through the file, and searching for the correct things in the url/request depending upon the starting character of the line in the easylist.txt file.
Privoxy is solid. If you want it to be completely API based though, check out the BrightCloud web filtering API as well.