All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.bybit.api.client.constant.Helper Maven / Gradle / Ivy

Go to download

The Official Java API connector for Bybit's HTTP and WebSocket APIs. Dive into a plethora of functionalities: - Market Data Retrieval - Trade Execution - Position Management - Account and Asset Info Retrieval - User and Upgrade Management — Public Websocket Streaming - Private Websocket Streaming - Lending Institution and Client - Broker Earning Data

The newest version!
package com.bybit.api.client.constant;

import java.util.HashMap;
import java.util.List;
import java.time.Instant;
import java.util.Map;
import java.util.UUID;

/**
 * Utility class
 */
public final class Helper {

    public static long generateTimestamp() {
        return Instant.now().toEpochMilli();
    }

    private Helper() {

    }

    public static Map convertQueryToMap(String query) {
        Map result = new HashMap<>();
        if (query == null || query.isEmpty()) {
            return result;
        }

        for (String param : query.split("&")) {
            String[] entry = param.split("=");
            if (entry.length > 1) {
                result.put(entry[0], entry[1]);
            }
        }

        return result;
    }

    public static String generateTransferID()
    {
        UUID uuid = UUID.randomUUID();
        return uuid.toString();
    }

    public static String listToString(List items) {
        return String.join(",", items);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy