MyPet Stocks icon

MyPet Stocks

Interact with MyPet Stocks quantitative trading system

Overview

This node interacts with the MyPet Stocks quantitative trading system, specifically allowing users to update an existing quantitative account's details. It is useful for managing and maintaining accurate account information within the trading platform. Typical scenarios include updating account metadata such as name, type, dealer, server, leverage, risk settings, and status after changes in trading conditions or user preferences.

For example, a user might update the maximum leverage or change the account's status from inactive to active to resume trading activities. Another use case could be correcting the account name or adjusting risk parameters to align with new trading strategies.

Properties

Name Meaning
Account to Update ID of the quantitative account to update
Account Name Name of the quantitative account
Account ID Quantitative account ID
Account Type Account type; options: MT4, MT5
Is Real Account Whether this is a real account (true) or demo account (false)
Dealer Select the dealer/broker (loaded dynamically from available dealers)
Server Server name associated with the account
Capital Type Capital type; options: USD (Dollar), Cent
Max Leverage Maximum leverage; options include 1:2, 1:20, 1:50, 1:100, 1:200, 1:400, 1:500, 1:800, 1:1000, 1:2000, 1:无限 (Unlimited)
View Password View password (optional)
Risk Risk value representing the maximum loss tolerated (not a percentage)
Time Zone Time zone; options include UTC, Europe/Moscow, Asia/Shanghai, America/New_York, Asia/Tokyo, Africa/Cairo, America/Los_Angeles
Status Account status; true for active, false for inactive
Note Optional note field for additional information

Output

The output JSON contains the result of the update operation with the following structure:

  • message: A string message indicating success or failure.
  • code: Numeric code representing the API response status.
  • account: The updated quantitative account object returned by the API, containing all updated fields and their current values.

Example output snippet:

{
  "message": "Update successful",
  "code": 0,
  "account": {
    "id": "123",
    "name": "Updated Account Name",
    "accountId": "ACC123",
    "account_type": "mt5",
    "is_real": true,
    "dealer": "456",
    "server": "ServerName",
    "capital_type": "usd",
    "max_lever": "1:100",
    "view_password": "optionalPassword",
    "risk": 100,
    "time_zone": "UTC",
    "status": true,
    "note": "Optional note"
  }
}

No binary data output is involved in this operation.

Dependencies

  • Requires an API key credential or username/password authentication for the MyPet Stocks API.
  • The node uses HTTP requests to communicate with the MyPet Stocks API endpoints.
  • The base URL and credentials must be configured in n8n credentials for the MyPet Stocks API.
  • Dynamic loading of dealers requires valid authentication and access to the dealers endpoint.

Troubleshooting

  • Authentication Errors: If authentication fails, ensure that the correct authentication method is selected (username/password or token) and that credentials are valid.
  • Update Failures: If the update operation returns an error code, check the message for details. Common issues include invalid account IDs, missing required fields, or permission issues.
  • Invalid Input: Required fields such as "Account to Update", "Account Name", and "Account ID" must be provided; otherwise, the node will throw errors.
  • Permission Denied: If the API returns permission errors, verify that the API key or user has sufficient rights to update accounts.
  • Network Issues: Ensure network connectivity to the MyPet Stocks API base URL.

Links and References

Discussion