I have an exchange data stream coming in that sets *symbol* to a random letter of the alphabet every like 10 ms in an infinite while loop that is calling func(pair, time). Symbol is the trading pair for simplification here. I have used A and Z to show the range.

Using the method below, I have to create a lot of if-statements when I want to count *i* for each letter. IE, I have to create iA, iB, iC, .. iZ. In reality, there is about 20 lines code to execute instead of the *i*-iteration shown here. This is very messy.

I am a beginner in coding and stuck with finding a more *elegant* and perhaps computationally *faster* way to do this.

```
def func(symbol, cur_time):

    if future_timeA > cur_timeA and symbol = A:
        iA += iA
    return -1

    if future_timeA < cur_timeA and symbol = A:
        future_timeA = cur_timeA + 1
        valueA = iA
    return valueA

    if future_timeZ > cur_timeZ and symbol = Z:
        iZ += iZ
    return -1

    if future_timeZ < cur_timeZ and symbol = Z:
        future_timeZ = cur_timeZ + 1
        value = iZ
    return valueZ 

```