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

org.knowm.xchange.simulated.AccountFactory Maven / Gradle / Ivy

package org.knowm.xchange.simulated;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.knowm.xchange.ExchangeSpecification;

/**
 * An instance of {@link AccountFactory} represents a single set of user accounts. A user account is
 * identified by its {@link ExchangeSpecification#getApiKey()} and consist of a set of per-currency
 * balances.
 *
 * 

If shared between {@link SimulatedExchange} instances, this ensures that they all share the * same scope of user accounts. * * @author Graham Crockford */ public class AccountFactory { private final ConcurrentMap accounts = new ConcurrentHashMap<>(); Account get(String apiKey) { return accounts.computeIfAbsent(apiKey, key -> new Account()); } }





© 2015 - 2025 Weber Informatics LLC | Privacy Policy