How to connect MetaTrader with a Node.JS? - node.js

I'm building a system, based on Node.JS, to connect with MetaTrader and to process all action like link account, open, close trade order...
But I still have not found out the way how to connect with MetaTrader in Nodejs. Can you give me a solution or package examples, that can help me do that?
Thanks!

You can try MetaApi https://metaapi.cloud cloud service which provides REST API and WebSocket API access to both MetaTrader 4 and MetaTrader 5 accounts.
Official REST API documentation: https://metaapi.cloud/docs/client
SDKs: https://metaapi.cloud/sdks (javascript, python and Java SDKs are provided as per April 2021)
It supports reading account information, positions, orders, trade history, receiving quotes, and accessing market data.
The service also provides copy trading API https://metaapi.cloud/docs/copyfactory and API to calculate forex trading metrics on a MetaTrader account https://metaapi.cloud/docs/metastats.
Update: as of mid Mar 2021 MetaApi allows limited API testing without adding a payment method

Observation:
MetaTrader software suite has multiple parts, only one of which is a customer-facing one - the MetaTrader Terminal 4/5. This terminal software communicates with MT4/5 Server and there are many other, additional Broker-side MetaTrader suite, server-cooperating systems.
Given your indication above, you seem to plan for Node.JS functional integration with MetaTrader Terminal piece of software.
Limitations:
As clarified above, the MetaTrader Terminal 4/5 software platform is the subject of interest and before technical steps are taken, a validation ought take place, so as to confirm, whether programmable features and services, natively supported inside MT4 Terminal are covering all you needs or not.
Given the MT4 Terminal has a programmable ecosystem for both for automated processing and for semi-automated back-testing, these two principal directions do not provide the same level of comfort for integration with an external cooperating logic or event-flow.
Given you project needs are not met with the built-in native MQL4/MQL5 code-execution environment, your further approach will have to be mixed with some GUI-manipulating assistive technologies, which may help to cover the gaps detected in the functional mapping pre-validation phase.
Approach:
For the purpose of making the MT4 Terminal code-execution ecosystem to cooperate with external worlds, there is a built in ability to #import extending features, not present in the native MQL4/5 language via DLL-s.
Having received this freedom of design, the user-code in the MQL4/5 language can borrow all missing features and services available for such integration projects.
Both Node.JS and MetaTrader Terminal 4/5 can use ZeroMQ and/or nanomsg for a fast and productive integration of a heterogeneous distributed system, which seems to be a match for your indicated needs.
Feel free to read other posts here and here, about signalling/messaging function-plane concepts, used for the sake of this very kind of system integration.

Related

Can do transaction control on multiple distributed data destination Nodejs?

I have the case write data to multiple data destination in nodejs
writeToMySql(data); //Step 1
postRestApi(data); //Step 2
writeToSqlServer(data); //Step 3
So the problems is data destination is distributed. I want to do something like "Transaction", if any step in 3 step fail, all 1,2,3 is rollback
But the Step 2 is rest Api, if data are posted to Api, I cannot roll back because the data is go in another server/ services;
So is there some way to do this concept? Thank everyone;
Generally, it is not something supported by Node JS and other "modern" software development platforms. You would need to rely on older techniques like sagas which would mean the development overhead of detecting and rolling back the transactions programmatically.
but it is important to remember that this is not a language thing so much as a platform thing. For example HTTP is not transactional, so if you implement REST style API on HTTP, you do not get the other enterprise distributed computing features. If you implemented the REST style with SOAP or CORBA (which was quite common), for example, then yes, features like XA and others are part of those protocols.
While this is slowly changing, many of the distributed computing features developed in the 1980 and 1990 such as distributed transaction management and security/identity propagation, were not included in "modern" software development due to a lack of awareness. These traditional features are slowly being included in "modern" software development as the proponents gain more experience in the problem space.

No free clustering with IBM API Connect?

I was about to use Strongloop for restructuring a Node.JS project when I saw that they are integrating Strongloop into IBM API Connect. The official page even points there.
However from a brief look at features, I saw that the IBM API gateway in contrast to Strongloop Arc (actually Strong Process manager) does not offer free clustering capabilities when deploying the program as PM did. It is mentioned as a paid feature...
I believe this is quite a setback, integrating a good product and limiting its open sourced services...
The API Gateway is different / separate from StrongPM and Arc in general. Some of the features previously available in Arc are now also part of API Connect's API Designer.
If you build an app on top of the LoopBack framework (which still is and should remain OSS), you can deploy that in whatever manner you wish with full clustering.
For example, you could deploy to Bluemix as a Node.js application and run multiple instances of your app for clustering / high-availability.
Or, you could deploy your application using StrongPM on your own hardware and get clustering that way.
If that doesn't answer your question, please clarify and I'll do what I can to provide updates.

How to evaluate a web service framework [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I am trying to evaluate different web service frameworks for API development in .Net. So far the frameworks I've been looking at are:
ServiceStack
MVC
Web API
NancyFx
I'm trying to find some common talking-points between the frameworks so I know what to look for when picking a framework. The talking points I've got so far are:
The Framework beliefs and principles
The Architecture of the framework (Client and Service side)
The Stack the framework provides you with
The Ease of development within the stack (plugins etc)
End-to-end performance benchmarks
Scalability benchmarks
Framework documentation availability
Framework Support (Cross platform etc)
Pricing
Overall Conclusion
Can anyone think of anything else I should think about? By the end of the research I'm hoping to write about each framework in detail and to make comparisons as to which framework to chose for a given purpose. Any help would be greatly appreciated.
End to End Productivity - The core essence for a Service is to provide a Service that ultimately delivers some value to its consumers. Therefore the end-to-end productivity of consuming services should also be strongly considered as the ease of which Services can be consumed from clients and least effort to consume them, ultimately provides more value to clients which is often more valuable than the productivity of developing Services themselves since the value is multiplied across its multiple consumers. As many services constantly evolve, the development workflow of updating Services and how easy it is to determine what's changed (i.e. if they have a static API) also impacts productivity on the client.
Interoperability - Another goal of a Service is interoperability and how well Services can be consumed from heterogeneous environments, most Web Service Frameworks just do HTTP however in many cases in Intranet environments sending API requests via a MQ is more appropriate as it provides greater resilience than HTTP, time-decoupling, natural load-balancing, decoupled endpoints, improved messaging workflows and error recovery, etc. There are also many Enterprises (and Enterprise products) that still only support or mandate SOAP so having SOAP endpoints and supporting XSD/WSDL metadata can also be valuable.
Versionability - Some API designs are naturally better suited to versioning where evolving Services can be enhanced defensively without breaking existing Service Consumers.
Testability and Mockability - You'll also want to compare the ease of which Services can be tested and mocked to determine how easy it is to create integration tests and whether it requires new knowledge and infrastructure as well as how easy it supports parallel client development which is important when front and backend teams develop solutions in parallel where the API contracts of a Service can be designed and agreed upon prior to development to ensure it meets the necessary requirements before implementation, then the front and backend teams can implement them independently of each other. If the Services haven't been implemented the clients would need to "mock" the Service responses until they have, then later switch to use the real services once they've been implemented.
Learnability how intuitive it is to develop Services, the amount of cognitive and conceptual overhead required also affects productivity and the ability to reason about how a Service Framework works and what it does has an impact on your Solutions overall complexity and your teams ability to make informed implementation decisions that affect performance and scalability and the effort it takes to ramp up new developers to learn your solution.

What is the latest and greatest socket.io benchmark module currently?

I would like to script benchmark of my socket.io implementation.
After some research I have identified several NodeJS modules, but they have either not been updated for past years (wsbench), or are only supporting websocket protocol (wsbench, thor) or is not testing socket.io implementation but socket.io project (socket.io-benchmark).
Since socket.io project has been highly active the past year, I wonder what is the latest and greatest tool/module to use for benchmarking?
My requirements:
Easy to script and run the tests
Test reports giving good overview of test runs
Test reports should be easy to save in order to compare with later benchmarking
Just came across this in search of some benchmarking for my Socket.IO project.
I found socket.io-benchmark, however had some additional items that I wanted to work through but found one of the forks nearly there.
https://github.com/slowthinker/socket.io-benchmark
I also forked it to add a cap on messagse/second sent to give it more realistic parameters.
Hope that helps!
I would suggest Artillery: Artillery is a modern, powerful, easy-to-use, open-source load-testing toolkit: https://github.com/shoreditch-ops/artillery
Here some feature:
Mulitple protocols: Load-test HTTP, WebSocket and Socket.io applications
Scenarios: Specify scenarios to test multi-step interactions in your API or web app
Perfomance metrics: get detailed performance metrics (latency, requests per second, concurrency, throughput)
Scriptable: write custom logic in JS to do pretty much anything
High performance: generate serious load on modest hardware
Integrations: statsd support out of the box for real-time reporting (integrate with Datadog, Librato, InfluxDB etc)
Extensible: custom reporting plugins, custom protocol engines etc
and more! HTML reports, nice CLI, parameterization with CSV files

Is it correct to use voiceXML as a tool in this scenario

I have a telephony scenario in which the following happens:
Customer calls a Voice Gateway
TCL script runs and a code is taken from customer
Authentication is done through a RADIUS server
Customer will hear correct voice menu
The problem is that RADIUS server must connect to a SQL Database and check the credentials. I have currently designed the solution using cisco secure ACS and through managed stored procedures on MS SQL server.
My question is: Is the VoiceXML a better tool to do this job and because some extenstions and wrappers of VoiceXML exists in .net, does it fit in this simple scenario??
Sincerely speaking, I am a little confisued with the technology and looking for a good tutorial on its features as well.
Thanks
In a strict sense, only step 4 is implemented by VoiceXML. Other aspects are handled by the platform or external code. VoiceXML is the standards mechanism for implementing step 4, but if all you are going to do is limited audio output and simple input, it may be overkill depending on the solutions available to you.
The following is just an example of a way to solve your problem and is fairly fictitious given I don't know anything about your environment nor constraints.
Given most VoiceXML platforms, upon receiving of a call your VoiceXML application will be executed. If this is a servlet/ASP based solution, you can perform steps 2 & 3 then generate/return the VoiceXML to play the menu, gather the input and move to the next step. If this is a static VoiceXML 2.1 solution, you can use a Data element call to make an HTTP request to a system that can perform these actions. The system will need to return XML that the Javascript/ECMAScript in VoiceXML application can parse and provide the correct audio output and input processing.
Since you are asking about VoiceXML, I'm assuming your challenge is the telephony aspect of the problem. Unless you have a system already available, choosing and activating a premise or hosted solution is far more complicated than the call flow code involved. Depending on your requirements, there are solutions as low as a single line, analog modem that supports audio output and DTMF input to massively scaled on premise and hosted solutions to handle 10,000s of concurrent calls that implement VoiceXML as well as a wide range of other call flow technologies.
VoiceXML would work fine in this scenario. There is a an open source project called VoiceModel that uses ASP.NET MVC to generate the VoiceXML and therefore integrates nicely with the .NET stack. There are a lot of examples in the project with discussions on how to use the examples in this blog. The examples use Voxeo Prophecy as the VoiceXML platform which has a SIP interface that will connect with a Voice Gateway. You can download two ports for free to try it out.

Resources