Seleccione Idioma
Developing a Cryptocurrency App to support your trading activities using the MNEClub's Crypto Signals API.
Introduction
This API documentation is a comprehensive guide that explains how to effectively use and integrate with your program application. It serves as a reference for developers, providing the necessary information to understand, implement, and troubleshoot the API.
{
"data": [
{
"ID": 1,
"CoinIdentifier": "bitcoin",
"CurrentPrice": "65000.00",
"MarketStatus": "Active",
"LastUpdated": "2024-07-30 12:00:00"
},
// ... more items ...
],
"pagination": {
"current_page": 1,
"per_page": 20,
"total_records": 100,
"total_pages": 5
}
}
$apiKey = "YOUR_API_KEY"; $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.mneclub.com/live-dataset/v1/"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: ' . $apiKey ]); $response = curl_exec($ch); curl_close($ch); echo $response;
$apiKey = "YOUR_API_KEY"; $page = 1; // The page number you want to retrieve $perPage = 20; // The number of items per page $ch = curl_init(); curl_setopt($ch, CURLOPT_URL, "https://www.mneclub.com/live-dataset/v1/?page={$page}&per_page={$perPage}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: ' . $apiKey ]); $response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } curl_close($ch); // Parse the JSON response $data = json_decode($response, true); // Check if the response was successfully decoded if (json_last_error() === JSON_ERROR_NONE) { // Access the data and pagination information $items = $data['data']; $pagination = $data['pagination']; // Use the data as needed foreach ($items as $item) { echo "ID: {$item['ID']}, Coin: {$item['CoinIdentifier']}, Price: {$item['CurrentPrice']}<br/>"; } // Display pagination info echo "Page {$pagination['current_page']} of {$pagination['total_pages']}<br/>"; echo "Total records: {$pagination['total_records']}<br/>"; } else { echo "Failed to parse JSON response"; }
const apiKey = "YOUR_API_KEY"; const page = 1; // The page number you want to retrieve const perPage = 20; // The number of items per page const apiUrl = 'https://www.mneclub.com/live-dataset/v1/?page=${page}&per_page=${perPage}'; fetch(apiUrl, { method: 'GET', headers: { 'Authorization': apiKey, 'Content-Type': 'application/json' } }) .then(response => { if (!response.ok) { throw new Error('HTTP error! status: ${response.status}'); } return response.json(); }) .then(data => { // Process the data console.log('Received data:', data); // Access the items const items = data.data; items.forEach(item => { console.log('ID: ${item.ID}, Coin: ${item.CoinIdentifier}, Price: ${item.CurrentPrice}'); }); // Access pagination info const pagination = data.pagination; console.log('Page ${pagination.current_page} of ${pagination.total_pages}'); console.log('Total records: ${pagination.total_records}`); }) .catch(error => { console.error('Error:', error); });
async function fetchData() { const apiKey = "YOUR_API_KEY"; const page = 1; const perPage = 20; const apiUrl = 'https://www.mneclub.com/live-dataset/v1/?page=${page}&per_page=${perPage}'; try { const response = await fetch(apiUrl, { method: 'GET', headers: { 'Authorization': apiKey, 'Content-Type': 'application/json' } }); if (!response.ok) { throw new Error('HTTP error! status: ${response.status}'); } const data = await response.json(); // Process the data console.log('Received data:', data); // Access the items const items = data.data; items.forEach(item => { console.log('ID: ${item.ID}, Coin: ${item.CoinIdentifier}, Price: ${item.CurrentPrice}'); }); // Access pagination info const pagination = data.pagination; console.log('Page ${pagination.current_page} of ${pagination.total_pages}'); console.log('Total records: ${pagination.total_records}'); } catch (error) { console.error('Error:', error); } } fetchData();
import requests def fetch_data(api_key, page=1, per_page=20): # API endpoint url = "https://www.mneclub.com/live-dataset/v1/" # Query parameters params = { "page": page, "per_page": per_page } # Headers headers = { "Authorization": api_key, "Content-Type": "application/json" } try: # Make the GET request response = requests.get(url, params=params, headers=headers) # Raise an exception for bad status codes response.raise_for_status() # Parse JSON response data = response.json() # Process the data items = data['data'] pagination = data['pagination'] print(f"Received {len(items)} items") for item in items: print(f"ID: {item['ID']}, Coin: {item['CoinIdentifier']}, Price: {item['CurrentPrice']}") print(f"Page {pagination['current_page']} of {pagination['total_pages']}") print(f"Total records: {pagination['total_records']}") return data except requests.exceptions.RequestException as e: print(f"An error occurred: {e}") return None # Usage api_key = "YOUR_API_KEY" result = fetch_data(api_key, page=1, per_page=20) if result: # Further processing if needed pass
pip install requests
import java.net.URI; import java.net.http.HttpClient; import java.net.http.HttpRequest; import java.net.http.HttpResponse; import java.util.concurrent.CompletableFuture; import org.json.JSONObject; import org.json.JSONArray; public class ApiClient { private static final String API_URL = "https://www.mneclub.com/live-dataset/v1/"; private final String apiKey; private final HttpClient httpClient; public ApiClient(String apiKey) { this.apiKey = apiKey; this.httpClient = HttpClient.newHttpClient(); } public CompletableFuture<Void> fetchData(int page, int perPage) { String url = String.format("%s?page=%d&per_page=%d", API_URL, page, perPage); HttpRequest request = HttpRequest.newBuilder() .uri(URI.create(url)) .header("Authorization", apiKey) .header("Content-Type", "application/json") .GET() .build(); return httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString()) .thenApply(HttpResponse::body) .thenAccept(this::processResponse) .exceptionally(e -> { System.err.println("An error occurred: " + e.getMessage()); return null; }); } private void processResponse(String responseBody) { JSONObject jsonResponse = new JSONObject(responseBody); JSONArray items = jsonResponse.getJSONArray("data"); JSONObject pagination = jsonResponse.getJSONObject("pagination"); System.out.println("Received " + items.length() + " items"); for (int i = 0; i < items.length(); i++) { JSONObject item = items.getJSONObject(i); System.out.printf("ID: %s, Coin: %s, Price: %s%n", item.getString("ID"), item.getString("CoinIdentifier"), item.getString("CurrentPrice")); } System.out.printf("Page %d of %d%n", pagination.getInt("current_page"), pagination.getInt("total_pages")); System.out.println("Total records: " + pagination.getInt("total_records")); } public static void main(String[] args) { String apiKey = "YOUR_API_KEY"; ApiClient client = new ApiClient(apiKey); client.fetchData(1, 20).join(); } }
<dependency> <groupId>org.json</groupId> <artifactId>json</artifactId> <version>20230227</version> </dependency>
implementation 'org.json:json:20230227'
using System; using System.Net.Http; using System.Net.Http.Headers; using System.Threading.Tasks; using Newtonsoft.Json.Linq; public class ApiClient { private readonly HttpClient _httpClient; private const string ApiKey = "YOUR_API_KEY"; public ApiClient() { _httpClient = new HttpClient(); _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ApiKey); } public async Task FetchDataAsync(int page = 1, int perPage = 20) { try { string url = $"https://www.mneclub.com/live-dataset/v1/?page={page}&per_page={perPage}"; HttpResponseMessage response = await _httpClient.GetAsync(url); response.EnsureSuccessStatusCode(); string responseBody = await response.Content.ReadAsStringAsync(); JObject data = JObject.Parse(responseBody); // Access the data and pagination information JArray items = (JArray)data["data"]; JObject pagination = (JObject)data["pagination"]; // Use the data as needed foreach (var item in items) { Console.WriteLine($"ID: {item["ID"]}, Coin: {item["CoinIdentifier"]}, Price: {item["CurrentPrice"]}"); } // Display pagination info Console.WriteLine($"Page {pagination["current_page"]} of {pagination["total_pages"]}"); Console.WriteLine($"Total records: {pagination["total_records"]}"); } catch (HttpRequestException e) { Console.WriteLine($"HTTP request error: {e.Message}"); } catch (Newtonsoft.Json.JsonException e) { Console.WriteLine($"Failed to parse JSON response: {e.Message}"); } } }
public class HomeController : Controller { private readonly ApiClient _apiClient = new ApiClient(); public async Task<IActionResult> Index() { await _apiClient.FetchDataAsync(); return View(); } }
curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: ' . $apiKey ]);
if ($response === false) { echo 'cURL Error: ' . curl_error($ch); } else { // Process $response here echo $response; }
$data = json_decode($response, true); if (json_last_error() === JSON_ERROR_NONE) { // Use $data here } else { echo "Failed to parse JSON response"; }
$apiKey = "YOUR_API_KEY"; $page = 1; // The page number you want to retrieve $perPage = 20; // The number of items per page $ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.mneclub.com/live-dataset/v1/?page={$page}&per_page={$perPage}"); curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: ' . $apiKey ]);
$response = curl_exec($ch); if (curl_errno($ch)) { echo 'Curl error: ' . curl_error($ch); } curl_close($ch);
// Parse the JSON response $data = json_decode($response, true);
if (json_last_error() === JSON_ERROR_NONE) { // Access the data and pagination information $items = $data['data']; $pagination = $data['pagination']; // Use the data as needed foreach ($items as $item) { echo "ID: {$item['ID']}, Coin: {$item['CoinIdentifier']}, Price: {$item['CurrentPrice']}<br/>"; } // Display pagination info echo "Page {$pagination['current_page']} of {$pagination['total_pages']}<br/>"; echo "Total records: {$pagination['total_records']}<br/>"; } else { echo "Failed to parse JSON response"; }
Key points about this Php implementation:
const apiKey = "YOUR_API_KEY"; const page = 1; // The page number you want to retrieve const perPage = 20; // The number of items per page const apiUrl = 'https://www.mneclub.com/live-dataset/v1/?page=${page}&per_page=${perPage}';
fetch(apiUrl, { method: 'GET', headers: { 'Authorization': apiKey, 'Content-Type': 'application/json' } })
.then(response => { if (!response.ok) { throw new Error('HTTP error! status: ${response.status}'); } return response.json(); })
.then(data => { // Process the data console.log('Received data:', data); // Access the items const items = data.data; items.forEach(item => { console.log('ID: ${item.ID}, Coin: ${item.CoinIdentifier}, Price: ${item.CurrentPrice}'); }); // Access pagination info const pagination = data.pagination; console.log('Page ${pagination.current_page} of ${pagination.total_pages}`); console.log('Total records: ${pagination.total_records}'); })
.catch(error => { console.error('Error:', error); });
Key differences from the other versions:
import requests def fetch_data(api_key, page=1, per_page=20):
url = "https://www.mneclub.com/live-dataset/v1/"
# Query parameters
params = {
"page": page,
"per_page": per_page
}
# Headers
headers = {
"Authorization": api_key,
"Content-Type": "application/json"
}
try:
# Make the GET request
response = requests.get(url, params=params, headers=headers)
# Raise an exception for bad status codes
response.raise_for_status()
# Parse JSON response
data = response.json()
# Process the data
items = data['data']
pagination = data['pagination']
print(f"Received {len(items)} items")
for item in items:
print(f"ID: {item['ID']}, Coin: {item['CoinIdentifier']}, Price: {item['CurrentPrice']}")
print(f"Page {pagination['current_page']} of {pagination['total_pages']}")
print(f"Total records: {pagination['total_records']}")
return data
except requests.exceptions.RequestException as e:
print(f"An error occurred: {e}")
return None
# Usage api_key = "YOUR_API_KEY" result = fetch_data(api_key, page=1, per_page=20) if result: # Further processing if needed pass
Key differences from the Php and C# versions:
public class ApiClient { private static final String API_URL = "https://www.mneclub.com/live-dataset/v1/"; private final String apiKey; private final HttpClient httpClient; public ApiClient(String apiKey) { this.apiKey = apiKey; this.httpClient = HttpClient.newHttpClient(); } // ... }
public CompletableFuture<Void> fetchData(int page, int perPage) {
String url = String.format("%s?page=%d&per_page=%d", API_URL, page, perPage);
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create(url))
.header("Authorization", apiKey)
.header("Content-Type", "application/json")
.GET()
.build();
return httpClient.sendAsync(request, HttpResponse.BodyHandlers.ofString())
.thenApply(HttpResponse::body)
.thenAccept(this::processResponse)
.exceptionally(e -> {
System.err.println("An error occurred: " + e.getMessage());
return null;
});
}
private void processResponse(String responseBody) {
JSONObject jsonResponse = new JSONObject(responseBody);
JSONArray items = jsonResponse.getJSONArray("data");
JSONObject pagination = jsonResponse.getJSONObject("pagination");
System.out.println("Received " + items.length() + " items");
for (int i = 0; i < items.length(); i++) {
JSONObject item = items.getJSONObject(i);
System.out.printf("ID: %s, Coin: %s, Price: %s%n",
item.getString("ID"),
item.getString("CoinIdentifier"),
item.getString("CurrentPrice"));
}
System.out.printf("Page %d of %d%n",
pagination.getInt("current_page"),
pagination.getInt("total_pages"));
System.out.println("Total records: " + pagination.getInt("total_records"));
}
public static void main(String[] args) {
String apiKey = "YOUR_API_KEY";
ApiClient client = new ApiClient(apiKey);
client.fetchData(1, 20).join();
}
public class ApiClient { private readonly HttpClient _httpClient; private const string ApiKey = "YOUR_API_KEY"; public ApiClient() { _httpClient = new HttpClient(); _httpClient.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue(ApiKey); }
public async Task FetchDataAsync(int page = 1, int perPage = 20)
{
try
{
string url = $"https://www.mneclub.com/live-dataset/v1/?page={page}&per_page={perPage}";
HttpResponseMessage response = await _httpClient.GetAsync(url);
response.EnsureSuccessStatusCode();
string responseBody = await response.Content.ReadAsStringAsync();
JObject data = JObject.Parse(responseBody);
// Access the data and pagination information
JArray items = (JArray)data["data"];
JObject pagination = (JObject)data["pagination"];
foreach (var item in items)
{
Console.WriteLine($"ID: {item["ID"]}, Coin: {item["CoinIdentifier"]}, Price: {item["CurrentPrice"]}");
}
// Display pagination info
Console.WriteLine($"Page {pagination["current_page"]} of {pagination["total_pages"]}");
Console.WriteLine($"Total records: {pagination["total_records"]}");
catch (HttpRequestException e)
{
Console.WriteLine($"HTTP request error: {e.Message}");
}
catch (Newtonsoft.Json.JsonException e)
{
Console.WriteLine($"Failed to parse JSON response: {e.Message}");
}
The main differences from the Php version are: