Using QuickFix/n to read a FIX log file - c#

I have a FIX format log file and a data structure I've built myself in C#. What I want to do is to run the log file in QuickFix and build my own event listener. In that listener, I'll convert the FIX types into the types I need and fill my DS.
I've been going through the QuickFix tutorials and examples, but couldn't figure it out. I don't need it to go through a network or anything like that.
Please help and thank you,
Yonatan

None of the QuickFIX ports provide this functionality. At best, you could build a simple app that could read the logfile line-by-line and pass each line to QF's Message(string) constructor. To convert that Message to a more specific type, you can feed it to a more-specific-type constructor, such as ExecutionReport(Message).
The above are for the original C++ QF. The other ports (QF/J and QF/n) should have similar mechanisms.
You will not be able to use the MessageCracker to fire OnMessage() events because you're not actually listening on a session. Instead, I'd recommend using a switch or doing an overload based on message class arguments.

Related

In .NET Core is there a specific way to prevent this file content log from being written as-is?

I'm using a JSON log sink which destructures complex properties. For some reason, Microsoft has this log built-in when you return a file content result from your controller action:
Executing {FileResultType}, sending file with download name '{FileDownloadName}' ...
Tat FileResultType has a nested property which includes the actual byte array, so my log space will be blown out if I don't get rid of this.
I know how to filter out a specific logger by name, so I can do that.. But I really just don't want this specific object to be logged out. I still find the rest of the message very helpful. I'm not sure if there's a flag I can toggle to bypass this or what since Microsoft is definitely aware that many people are using log sinks which serialize complex objects instead of just calling .ToString(), but I haven't found anything yet. I'm using NLog so I'm sure I can get creative there with some if conditions, but it'd be pretty inefficient because that check would have to run on every single log attempt.

Unified communication

I am wondering how should I set up interprocess unified communication in better way than I do now. Client process sends a lot of messages of different sort to the server process. Messages like... I have done some work[what],I started at [time], ended at[time]. or state, progress even command messages.
example message: From:Process1;StartedAt|12:12:12;EndedAt|12:45:56;DoneUnit:51
Server parser split string by semicolon. From first part reads from who was message sent. from second and third part it reads times and from last how much work it did.
When I add another info at the end of message
ex. From:Process1;StartedAt|12:12:12;EndedAt|12:45:56;DoneUnit:51;Source:tableT
I have to rewrite the server parser as well.
Server tries to parse received message using my own parse function. Every message has its own format. So parser know how should message look. But if I change the format on client I have to change it on server as well. It does not seems to be very efficient way.
For that reason I ask you a question.
How should this communication get better or is there any different approach how to store the format for client and server on one place?
I use c# .net 3.5(Must be this version)
Thank you for reply
The obvious solution to your problem would be to not write the parsing code yourself.
If you create a class that can be serialized, you can send the serialized version of the class over the wire and deserialize at the other end. That means the message class can be shared between both applications, and the parsing code is trivial. Depending on your requirements, you can use various serializers: Xml or JSON would be verbose but human-readable, or the binary serializer would be more efficient in terms of bandwidth (but harder to debug or monitor over-the-wire).

Reading quickfix log file

I want to test my trading system by playing execution reports back into my application. Then I could verify that my order/position state is correct.
I found this somewhat related question: how to replay a quickfix log
The difference is that in the article the person was looking for a whole testing tool that would play back a log file. What I was wondering is whether there exists a utility that will take a string representing a FIX message and then just generate a FIX object (ex: ExecutionReport).
Does anything like this exist out there? Has everyone just been writing their own?
It sounds like you simply want a different kind of test tool.
If you've written your app in unit-test-friendly fashion, then you could simply write unit tests to create ExecReport objects and pass them as parameters into some ExecReport-processor component. (I'm guessing you're not designing for UTs, else you probably wouldn't need this suggestion.)
If not, then I think the best thing to do is write another app that your first app can connect to. You could create a simple Acceptor app that can use command-line commands to trigger ExecReports to be sent. If you're using QuickFIX/n (the C# port), you could steal code from QuickFIX/n's example apps "TradeClient" and "Executor".

C# FTP library vs FTP command line application

I have an option to use either the C# FTP library or the standard FTP command line application to connect and to retrieve data from an FTP server.
Can some one advice on what to prefer.?
Thanks.
Why would you be using a commandline tool, intended for end users, from code? You'll be having a hard time reading and parsing stdout and stderr to get the responses or errors that result from your commands.
Just use the FtpWebRequest and FtpWebResponse since they provide in a decent, easy-to-use interface that contains error checking and so on.
Try to stay in a language's idiom where possible, so use a library when you can. Errors will be handled using C#'s Exceptions rather than checking some obscure command-line errorlevel value.
Using a Library, you have access to the classes, events, exception handling and so on, which integrate much better with your code. I would say that's more maintainable than having to interpret the text output and return codes of a commmand line application. So my suggestion is to use the library.

Compile swf at runtime via C#?

I'd like to know if it's possible to compile an .swf file at runtime via C# (would be called via a Flex Application). I've read some articles about using fsch.exe, but nothing that gave any concrete examples.
I'm fairly certain this is possible, so a secondary question is whether it's feasible on a medium scale. I'd like to allow users to configure an swf, and then compile those settings directly into the swf for delivery rather than relying on external data storage for holding configuration details.
Thanks in advance for any assistance you can offer -
Bill
You should be able to do this fairly simply using a command line compiler.
You need to be able to setup the compiler on your server. http://www.google.com.au/search?hl=en&q=swf+command+line+compiler&btnG=Search&meta=
In your C# code you can then execute a shell command to invoke your compiler. http://www.google.com.au/search?hl=en&q=execute+command+shell+asp+.net&btnG=Search&meta=
One thing to be careful with is waiting for the compiler to finish before attempting to retrieve the compiled file. You will need to process the response from the compiler and ensure that the compilation succeeded.
I don't see why this wouldn't be feasible on a medium scale.
You can try MTASC.. it's command line based ActionScript compiler so you can just use Process.Start to call it and then use the Process.WaitForExit method to wait until it finishes compiling

Categories